[MIG] stock_picking_report_valued_sale_mrp: Migration to 13.0

This commit is contained in:
david
2021-06-04 11:41:05 +02:00
committed by Ernesto Tejeda
parent 4960674641
commit 284abd4248
9 changed files with 36 additions and 19 deletions

View File

@@ -14,13 +14,13 @@ Valued picking linked with MRP Kits
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--reporting-lightgray.png?logo=github
:target: https://github.com/OCA/stock-logistics-reporting/tree/12.0/stock_picking_report_valued_sale_mrp
:target: https://github.com/OCA/stock-logistics-reporting/tree/13.0/stock_picking_report_valued_sale_mrp
:alt: OCA/stock-logistics-reporting
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/stock-logistics-reporting-12-0/stock-logistics-reporting-12-0-stock_picking_report_valued_sale_mrp
:target: https://translation.odoo-community.org/projects/stock-logistics-reporting-13-0/stock-logistics-reporting-13-0-stock_picking_report_valued_sale_mrp
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/151/12.0
:target: https://runbot.odoo-community.org/runbot/151/13.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -69,7 +69,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-reporting/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/stock-logistics-reporting/issues/new?body=module:%20stock_picking_report_valued_sale_mrp%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/stock-logistics-reporting/issues/new?body=module:%20stock_picking_report_valued_sale_mrp%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues.
@@ -87,6 +87,7 @@ Contributors
* `Tecnativa <https://www.tecnativa.com>`_:
* David Vidal
* Carlos Roca
Maintainers
~~~~~~~~~~~
@@ -109,6 +110,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
|maintainer-chienandalu|
This module is part of the `OCA/stock-logistics-reporting <https://github.com/OCA/stock-logistics-reporting/tree/12.0/stock_picking_report_valued_sale_mrp>`_ project on GitHub.
This module is part of the `OCA/stock-logistics-reporting <https://github.com/OCA/stock-logistics-reporting/tree/13.0/stock_picking_report_valued_sale_mrp>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@@ -3,7 +3,7 @@
{
"name": "Valued picking linked with MRP Kits",
"summary": "Allow to summarize the picking related with the selled kits",
"version": "12.0.1.0.2",
"version": "13.0.1.0.0",
"development_status": "Beta",
"category": "Warehouse Management",
"website": "https://github.com/OCA/stock-logistics-reporting",

View File

@@ -1,12 +1,12 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_picking_report_valued_sale_mrp
# * stock_picking_report_valued_sale_mrp
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: <>\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -37,4 +37,3 @@ msgstr ""
#: model:ir.model,name:stock_picking_report_valued_sale_mrp.model_stock_move
msgid "Stock Move"
msgstr ""

View File

@@ -12,7 +12,11 @@ class StockMove(models.Model):
were manually changed, it could lead to inconsistencies"""
self.ensure_one()
sale_line = self.sale_line_id
if not sale_line or not sale_line.product_id._is_phantom_bom():
if (
not sale_line
or not sale_line.product_id.get_components()
or sale_line.product_id.ids == sale_line.product_id.get_components()
):
return 0
component_demand = sum(
sale_line.move_ids.filtered(

View File

@@ -23,8 +23,11 @@ class StockMoveLine(models.Model):
@api.depends("sale_line")
def _compute_phantom_product_id(self):
"""Relate every line with its kit product"""
self.write({"phantom_product_id": False})
for line in self.filtered(
lambda x: x.sale_line and x.sale_line.product_id._is_phantom_bom()
lambda x: x.sale_line
and x.sale_line.product_id.get_components()
and x.sale_line.product_id.ids != x.sale_line.product_id.get_components()
):
line.phantom_product_id = line.sale_line.product_id
@@ -33,7 +36,11 @@ class StockMoveLine(models.Model):
avoid duplicate the amounts. We also need to recompute the total
amounts according to the corresponding delivered kits"""
super()._compute_sale_order_line_fields()
kit_lines = self.filtered("phantom_product_id")
pickings = self.mapped("picking_id")
kit_lines = pickings.move_line_ids.filtered("phantom_product_id")
pickings.move_line_ids.write(
{"phantom_line": False, "phantom_delivered_qty": 0.0}
)
for sale_line in kit_lines.mapped("sale_line"):
move_lines = kit_lines.filtered(lambda x: x.sale_line == sale_line)
# Deduct the kit quantity from the first component in the picking.

View File

@@ -1,3 +1,4 @@
* `Tecnativa <https://www.tecnativa.com>`_:
* David Vidal
* Carlos Roca

View File

@@ -28,17 +28,17 @@
/>
</xpath>
<xpath
expr="//span[@t-field='move_line.product_id.sudo().description_pickingout']"
expr="//span[@t-field='move_line.move_id.description_picking']"
position="attributes"
>
<attribute name="t-if">not move_line.phantom_line</attribute>
</xpath>
<xpath
expr="//span[@t-field='move_line.product_id.sudo().description_pickingout']"
expr="//span[@t-field='move_line.move_id.description_picking']"
position="before"
>
<span
t-field="move_line.sale_line.product_id.sudo().description_pickingout"
t-esc="move_line.sale_line.product_id.sudo()._get_description(o.picking_type_id)"
t-if="move_line.phantom_line"
/>
</xpath>

View File

@@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/stock-logistics-reporting/tree/12.0/stock_picking_report_valued_sale_mrp"><img alt="OCA/stock-logistics-reporting" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--reporting-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/stock-logistics-reporting-12-0/stock-logistics-reporting-12-0-stock_picking_report_valued_sale_mrp"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/151/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/stock-logistics-reporting/tree/13.0/stock_picking_report_valued_sale_mrp"><img alt="OCA/stock-logistics-reporting" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--reporting-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/stock-logistics-reporting-13-0/stock-logistics-reporting-13-0-stock_picking_report_valued_sale_mrp"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/151/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This module extends the functionality of <cite>stock_picking_report_valued</cite> with
compatibility of MRP kits. Now well be able to correctly summarize the picking
value related to the selled kit with a relations of components and serials/lots
@@ -420,7 +420,7 @@ the order well have an incorrect reference as well.</li>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/stock-logistics-reporting/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/stock-logistics-reporting/issues/new?body=module:%20stock_picking_report_valued_sale_mrp%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/stock-logistics-reporting/issues/new?body=module:%20stock_picking_report_valued_sale_mrp%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
@@ -436,6 +436,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<ul class="simple">
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
<li>David Vidal</li>
<li>Carlos Roca</li>
</ul>
</li>
</ul>
@@ -449,7 +450,7 @@ mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<p><a class="reference external" href="https://github.com/chienandalu"><img alt="chienandalu" src="https://github.com/chienandalu.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/stock-logistics-reporting/tree/12.0/stock_picking_report_valued_sale_mrp">OCA/stock-logistics-reporting</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/stock-logistics-reporting/tree/13.0/stock_picking_report_valued_sale_mrp">OCA/stock-logistics-reporting</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>

View File

@@ -69,3 +69,7 @@ class TestStockPickingValuedMrp(TestStockPickingValued):
self.assertAlmostEqual(self.order_out_picking.amount_untaxed, 149.5)
self.assertAlmostEqual(self.order_out_picking.amount_tax, 14.95)
self.assertAlmostEqual(self.order_out_picking.amount_total, 164.45)
# Run the report to detect hidden errors
self.env.ref("stock.action_report_delivery").render_qweb_html(
self.order_out_picking.ids
)