Skip to content

Commit

Permalink
[MIG] stock_picking_report_valued: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenminhchien committed Jan 15, 2024
1 parent 943cb28 commit bcc061b
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 38 deletions.
7 changes: 6 additions & 1 deletion stock_picking_report_valued/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ valued with reserved quantity.
Configuration
=============

1. Go to *Customers > (select one of your choice) > Sales & Purchases*.
1. Go to *Sales > Orders > Customers > (select one of your choice) >
Sales & Purchases*.
2. Set *Valued picking* field on.

Usage
Expand Down Expand Up @@ -107,6 +108,10 @@ Contributors

- Miguel Gandia <[email protected]>

- `Trobz <https://trobz.com>`__:

- Nguyen Minh Chien <[email protected]>

Maintainers
-----------

Expand Down
2 changes: 1 addition & 1 deletion stock_picking_report_valued/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{
"name": "Valued Picking Report",
"summary": "Adding Valued Picking on Delivery Slip report",
"version": "16.0.1.0.0",
"version": "17.0.1.0.0",
"author": "Tecnativa, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/stock-logistics-reporting",
"category": "Warehouse Management",
Expand Down
2 changes: 1 addition & 1 deletion stock_picking_report_valued/models/stock_move_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class StockMoveLine(models.Model):
)

def _get_report_valued_quantity(self):
return self.qty_done or self.reserved_qty
return self.quantity or self.reserved_qty

def _compute_sale_order_line_fields(self):
"""This is computed with sudo for avoiding problems if you don't have
Expand Down
2 changes: 1 addition & 1 deletion stock_picking_report_valued/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
1. Go to *Customers \> (select one of your choice) \> Sales &
1. Go to *Sales \> Orders \> Customers \> (select one of your choice) \> Sales &
Purchases*.
2. Set *Valued picking* field on.
2 changes: 2 additions & 0 deletions stock_picking_report_valued/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@
- Aritz Olea \<<[email protected]>\>
- [Studio73](https://www.studio73.es):
- Miguel Gandia \<<[email protected]>\>
- [Trobz](https://trobz.com):
- Nguyen Minh Chien \<<[email protected]>\>
42 changes: 12 additions & 30 deletions stock_picking_report_valued/report/stock_picking_report_valued.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>

<template id="valued_report_picking" inherit_id="stock.report_delivery_document">
<template
id="valued_report_picking"
inherit_id="stock.report_delivery_document"
priority="17"
>
<xpath expr="//div[hasclass('page')]" position="before">
<t t-set="is_outgoing" t-value="o.picking_type_code == 'outgoing'" />
</xpath>
<xpath
expr="//table[@t-if=&quot;o.move_line_ids and o.state==&apos;done&apos;&quot;]/thead/tr"
position="inside"
>
<xpath expr="//table[@name='stock_move_line_table']/thead/tr" position="inside">
<t t-if="o.valued and o.sale_id and o.move_line_ids and is_outgoing">
<t t-if="o.state != 'done'">
<th class="text-end"><strong>Qty Reserved</strong></th>
</t>
<th class="text-end"><strong>Unit Price</strong></th>
<th class="text-end" groups="product.group_discount_per_so_line">
<strong>Discount</strong>
Expand All @@ -28,6 +26,9 @@
separator=" "
/>
</xpath>
<xpath expr="//th[@name='th_sml_qty_ordered']" position="after">
<t t-elif="not has_serial_number" />
</xpath>
<xpath
expr="//t[@t-foreach='packages']//t[@t-if='has_serial_number']"
position="attributes"
Expand Down Expand Up @@ -58,10 +59,7 @@
separator=" "
/>
</xpath>
<xpath
expr="//table[@t-if=&quot;o.move_line_ids and o.state==&apos;done&apos;&quot;]"
position="after"
>
<xpath expr="//table[@name='stock_move_line_table']" position="after">
<t t-if="o.valued and o.sale_id and o.move_line_ids and is_outgoing">
<table class="table table-sm mt32">
<thead>
Expand Down Expand Up @@ -92,18 +90,9 @@
<template
id="valued_report_picking_has_serial_move_line"
inherit_id="stock.stock_report_delivery_has_serial_move_line"
priority="17"
>
<xpath expr="//td[@name='move_line_lot_qty_done']" position="after">
<t t-if="move_line.picking_id.state != 'done'">
<td class="text-end">
<span t-field="move_line.product_uom_qty" />
<span t-field="move_line.product_uom_id" /></td>
</t>
<t t-elif="move_line.picking_id.state == 'done'">
<td class="text-center">
<span t-field="move_line.qty_done" />
<span t-field="move_line.product_uom_id" /></td>
</t>
<xpath expr="." position="inside">
<t t-if="o.valued and o.sale_id and o.move_line_ids and is_outgoing">
<td class="text-end"><span t-field="move_line.sale_price_unit" /></td>
<td class="text-end" groups="product.group_discount_per_so_line">
Expand All @@ -117,13 +106,6 @@
/></td>
</t>
</xpath>
<xpath expr="//td[@name='move_line_lot_qty_done']" position="attributes">
<attribute
name="t-if"
add="not (o.valued or o.sale_id or o.move_line_ids or is_outgoing)"
separator=" "
/>
</xpath>
</template>

</odoo>
8 changes: 6 additions & 2 deletions stock_picking_report_valued/static/description/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
Expand Down Expand Up @@ -392,7 +391,8 @@ <h1 class="title">Valued Picking Report</h1>
<div class="section" id="configuration">
<h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
<ol class="arabic simple">
<li>Go to <em>Customers &gt; (select one of your choice) &gt; Sales &amp; Purchases</em>.</li>
<li>Go to <em>Sales &gt; Orders &gt; Customers &gt; (select one of your choice) &gt;
Sales &amp; Purchases</em>.</li>
<li>Set <em>Valued picking</em> field on.</li>
</ol>
</div>
Expand Down Expand Up @@ -458,6 +458,10 @@ <h2><a class="toc-backref" href="#toc-entry-7">Contributors</a></h2>
<li>Miguel Gandia &lt;<a class="reference external" href="mailto:miguel&#64;studio73.es">miguel&#64;studio73.es</a>&gt;</li>
</ul>
</li>
<li><a class="reference external" href="https://trobz.com">Trobz</a>:<ul>
<li>Nguyen Minh Chien &lt;<a class="reference external" href="mailto:chien&#64;trobz.com">chien&#64;trobz.com</a>&gt;</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="maintainers">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
class TestStockPickingValued(common.TransactionCase):
@classmethod
def setUpClass(cls):
super(TestStockPickingValued, cls).setUpClass()
super().setUpClass()
company = cls.env.user.company_id
cls.tax = cls.env["account.tax"].create(
{
Expand Down Expand Up @@ -136,7 +136,7 @@ def test_05_distinct_qty(self):
self.assertTrue(len(self.sale_order.picking_ids))
for picking in self.sale_order.picking_ids:
picking.action_assign()
picking.move_line_ids.qty_done = 2.0
picking.move_line_ids.quantity = 2.0
self.assertEqual(picking.amount_untaxed, 200.0)
self.assertEqual(picking.amount_tax, 30.0)
self.assertEqual(picking.amount_total, 230.0)

0 comments on commit bcc061b

Please sign in to comment.