[MIG] stock_picking_report_undelivered_product: Migration to v13.0

This commit is contained in:
sergio-teruel
2021-02-17 16:08:56 +01:00
parent 174f5551aa
commit 74efe3e337
8 changed files with 100 additions and 63 deletions

View File

@@ -14,13 +14,13 @@ Stock picking report undelivered products
: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_undelivered_product
:target: https://github.com/OCA/stock-logistics-reporting/tree/13.0/stock_picking_report_undelivered_product
: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_undelivered_product
:target: https://translation.odoo-community.org/projects/stock-logistics-reporting-13-0/stock-logistics-reporting-13-0-stock_picking_report_undelivered_product
: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|
@@ -65,7 +65,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_undelivered_product%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_undelivered_product%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.
@@ -98,6 +98,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
This module is part of the `OCA/stock-logistics-reporting <https://github.com/OCA/stock-logistics-reporting/tree/12.0/stock_picking_report_undelivered_product>`_ 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_undelivered_product>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@@ -4,9 +4,9 @@
{
"name": "Stock picking report undelivered products",
"summary": "Display on picking report delivery slip undelivered products",
"version": "12.0.1.0.0",
"version": "13.0.1.0.0",
"author": "Tecnativa,Odoo Community Association (OCA)",
"website": "https://www.tecnativa.com",
"website": "https://github.com/OCA/stock-logistics-reporting",
"category": "Warehouse",
"license": "AGPL-3",
"depends": ["stock"],

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_undelivered_product"><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_undelivered_product"><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_undelivered_product"><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_undelivered_product"><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 stock module to allow to
display undelivered products in the delivery slip report.</p>
<p>You have three options to display lines:</p>
@@ -414,7 +414,7 @@ completely lines).</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_undelivered_product%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_undelivered_product%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">
@@ -445,7 +445,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.</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_undelivered_product">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_undelivered_product">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

@@ -11,23 +11,18 @@ class TestStockPickingReportUndeliveredProduct(common.TransactionCase):
self.ProductProduct = self.env["product.product"]
self.StockPicking = self.env["stock.picking"]
self.StockQuant = self.env["stock.quant"]
self.BackOrderWiz = self.env["stock.backorder.confirmation"]
self.warehouse = self.env.ref("stock.warehouse0")
self.stock_location = self.env.ref("stock.stock_location_stock")
self.customer_location = self.env.ref("stock.stock_location_customers")
self.picking_type_out = self.env.ref("stock.picking_type_out")
self.partner_display = self.ResPartner.create(
{
"name": "Partner for test display",
"customer": True,
"display_undelivered_in_picking": True,
}
{"name": "Partner for test display", "display_undelivered_in_picking": True}
)
self.partner_no_display = self.ResPartner.create(
{
"name": "Partner for test on display",
"customer": True,
"display_undelivered_in_picking": False,
}
)
@@ -77,14 +72,17 @@ class TestStockPickingReportUndeliveredProduct(common.TransactionCase):
line.product_uom_qty = 20.00
return picking_form.save()
def _transfer_picking_no_backorder(self, picking):
# Transfer picking with no create backorder option
backorder_wizard = self.BackOrderWiz.create({"pick_ids": [(4, picking.id)]})
backorder_wizard.process_cancel_backorder()
def test_displayed_customer(self):
picking = self._create_picking(self.partner_display)
picking.action_confirm()
picking.action_assign()
picking.move_line_ids.qty_done = 10.00
picking.action_done()
# Cancel backorder
picking.backorder_ids.action_cancel()
self._transfer_picking_no_backorder(picking)
res = (
self.env["ir.actions.report"]
._get_report_from_name("stock.report_deliveryslip")
@@ -97,9 +95,7 @@ class TestStockPickingReportUndeliveredProduct(common.TransactionCase):
picking.action_confirm()
picking.action_assign()
picking.move_line_ids.qty_done = 10.00
picking.action_done()
# Cancel backorder
picking.backorder_ids.action_cancel()
self._transfer_picking_no_backorder(picking)
res = (
self.env["ir.actions.report"]
._get_report_from_name("stock.report_deliveryslip")
@@ -115,9 +111,7 @@ class TestStockPickingReportUndeliveredProduct(common.TransactionCase):
picking.action_confirm()
picking.action_assign()
picking.move_line_ids.qty_done = 10.00
picking.action_done()
# Cancel backorder
picking.backorder_ids.action_cancel()
self._transfer_picking_no_backorder(picking)
res = (
self.env["ir.actions.report"]
._get_report_from_name("stock.report_deliveryslip")
@@ -161,9 +155,7 @@ class TestStockPickingReportUndeliveredProduct(common.TransactionCase):
picking.action_confirm()
picking.action_assign()
picking.move_line_ids.qty_done = 10.00
picking.action_done()
# Cancel backorder
picking.backorder_ids.action_cancel()
self._transfer_picking_no_backorder(picking)
# Empty setting method field
picking.company_id.undelivered_product_slip_report_method = False

View File

@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="view_template_property_form" model="ir.ui.view">
<field name="model">product.template</field>
<field name="inherit_id" ref="stock.view_template_property_form"/>
<field name="inherit_id" ref="stock.view_template_property_form" />
<field name="arch" type="xml">
<group name="group_lots_and_weight" position="inside">
<field name="display_undelivered_in_picking"/>
<field name="display_undelivered_in_picking" />
</group>
</field>
</record>

View File

@@ -1,24 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template id="undeliverd_product">
<t t-if="o.partner_id.display_undelivered_in_picking and o.backorder_ids">
<t t-if="o.partner_id.display_undelivered_in_picking and o.state == 'done'">
<!-- Get stock moves from backorder according to setting values -->
<t t-if="not o.company_id.undelivered_product_slip_report_method or o.company_id.undelivered_product_slip_report_method == 'all'">
<t t-set="backorder_moves"
t-value="o.backorder_ids.mapped('move_lines').filtered(lambda l: l.state == 'cancel' and l.product_id.display_undelivered_in_picking)"/>
<t
t-if="not o.company_id.undelivered_product_slip_report_method or o.company_id.undelivered_product_slip_report_method == 'all'"
>
<t
t-set="undelivered_moves"
t-value="o.mapped('move_lines').filtered(lambda l: l.quantity_done == 0.0 and l.state == 'cancel' and l.product_id.display_undelivered_in_picking)"
/>
</t>
<t t-if="o.company_id.undelivered_product_slip_report_method == 'partially_undelivered'">
<t t-set="backorder_moves"
t-value="o.backorder_ids.mapped('move_lines').filtered(lambda l: l.state == 'cancel' and l.product_id.display_undelivered_in_picking and l.splitted_stock_move_orig_id)"/>
<t
t-if="o.company_id.undelivered_product_slip_report_method == 'partially_undelivered'"
>
<t
t-set="undelivered_moves"
t-value="o.mapped('move_lines').filtered(lambda l: l.state == 'cancel' and l.product_id.display_undelivered_in_picking and l.splitted_stock_move_orig_id)"
/>
</t>
<t t-if="o.company_id.undelivered_product_slip_report_method == 'completely_undelivered'">
<t t-set="backorder_moves"
t-value="o.backorder_ids.mapped('move_lines').filtered(lambda l: l.state == 'cancel' and l.product_id.display_undelivered_in_picking and not l.splitted_stock_move_orig_id)"/>
<t
t-if="o.company_id.undelivered_product_slip_report_method == 'completely_undelivered'"
>
<t
t-set="undelivered_moves"
t-value="o.mapped('move_lines').filtered(lambda l: l.state == 'cancel' and l.product_id.display_undelivered_in_picking and not l.splitted_stock_move_orig_id)"
/>
</t>
<table t-if="backorder_moves" class="table table-sm table-bordered mt0" id="undelivered_product">
<table
t-if="undelivered_moves"
class="table table-sm table-bordered mt0"
id="undelivered_product"
>
<thead>
<tr><th colspan="7"><strong>Remaining products (not delivered yet)</strong></th></tr>
<tr><th colspan="7"><strong
>Remaining products (not delivered yet)</strong></th></tr>
<tr>
<th><strong>Reference</strong></th>
<th><strong>Product</strong></th>
@@ -26,16 +43,28 @@
</tr>
</thead>
<tbody>
<t t-foreach="backorder_moves.sorted(key=lambda l: (l.product_id.default_code, l.product_id.name))" t-as="backorder_move">
<tr t-att-class="'partially_undelivered_line' if backorder_move.splitted_stock_move_orig_id else 'completely_undelivered_line'">
<t
t-foreach="undelivered_moves.sorted(key=lambda l: (l.product_id.default_code, l.product_id.name))"
t-as="undelivered_move"
>
<tr
t-att-class="'partially_undelivered_line' if undelivered_move.splitted_stock_move_orig_id else 'completely_undelivered_line'"
>
<td>
<span t-field="backorder_move.product_id.default_code"/>
<span
t-field="undelivered_move.product_id.default_code"
/>
</td>
<td>
<span t-field="backorder_move.product_id.name"/>
<span t-field="undelivered_move.product_id.name" />
</td>
<td class="text-right">
<span t-field="backorder_move.product_uom_qty"/> <span groups="uom.group_uom" t-field="backorder_move.product_uom"/>
<span
t-field="undelivered_move.product_uom_qty"
/> <span
groups="uom.group_uom"
t-field="undelivered_move.product_uom"
/>
</td>
</tr>
</t>
@@ -44,9 +73,16 @@
</t>
</template>
<template id="report_delivery_document" inherit_id="stock.report_delivery_document" priority="200">
<xpath expr="//table[@t-if=&quot;o.move_line_ids and o.state=='done'&quot;]" position="after">
<t t-call="stock_picking_report_undelivered_product.undeliverd_product"/>
<template
id="report_delivery_document"
inherit_id="stock.report_delivery_document"
priority="200"
>
<xpath
expr="//table[@t-if=&quot;o.move_line_ids and o.state=='done'&quot;]"
position="after"
>
<t t-call="stock_picking_report_undelivered_product.undeliverd_product" />
</xpath>
</template>

View File

@@ -1,22 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="res_config_settings_view_form" model="ir.ui.view">
<field name="name">res.config.settings.view.form.inherit.undelivered.product</field>
<field
name="name"
>res.config.settings.view.form.inherit.undelivered.product</field>
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="stock.res_config_settings_view_form"/>
<field name="inherit_id" ref="stock.res_config_settings_view_form" />
<field name="arch" type="xml">
<div data-key="stock" position="inside">
<h2>Report picking undelivered products</h2>
<div class="row mt16 o_settings_container">
<div class="col-12 col-lg-12 o_setting_box" title="Select method to display undelivered product lines">
<div
class="col-12 col-lg-12 o_setting_box"
title="Select method to display undelivered product lines"
>
<div class="o_setting_right_pane">
<label for="undelivered_product_slip_report_method"/>
<label for="undelivered_product_slip_report_method" />
<div class="text-muted">
Undelivered product lines in delivery slip report
</div>
<div class="content-group">
<div class="mt16">
<field name="undelivered_product_slip_report_method" class="o_light_label" widget="selection"/>
<field
name="undelivered_product_slip_report_method"
class="o_light_label"
widget="selection"
/>
</div>
</div>
</div>

View File

@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record model="ir.ui.view" id="view_partner_stock_form">
<field name="model">res.partner</field>
<field name="type">form</field>
<field name="inherit_id" ref="stock.view_partner_stock_form"/>
<field name="inherit_id" ref="stock.view_partner_stock_form" />
<field name="arch" type="xml">
<group name="warehouse" position="inside">
<field name="display_undelivered_in_picking"/>
<group name="inventory" position="inside">
<field name="display_undelivered_in_picking" />
</group>
</field>
</record>