mirror of
https://github.com/OCA/stock-logistics-reporting.git
synced 2025-02-16 17:13:21 +02:00
[MIG] stock_picking_report_custom_description: Migration to 16.0
This commit is contained in:
committed by
juancarlosonate-tecnativa
parent
1a159eca76
commit
ec0bb71531
@@ -1,12 +1,13 @@
|
||||
# Copyright 2017 Tecnativa - Carlos Dauden
|
||||
# Copyright 2018 Tecnativa - Vicent Cubells
|
||||
# Copyright 2018 Tecnativa - Sergio Teruel
|
||||
# Copyright 2023 Tecnativa - Carolina Fernandez
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
{
|
||||
"name": "Stock Picking Report Custom Description",
|
||||
"summary": "Show moves description in picking reports",
|
||||
"version": "15.0.1.0.0",
|
||||
"version": "16.0.1.0.0",
|
||||
"category": "Warehouse",
|
||||
"website": "https://github.com/OCA/stock-logistics-reporting",
|
||||
"author": "Tecnativa, Odoo Community Association (OCA)",
|
||||
@@ -16,9 +17,5 @@
|
||||
"depends": [
|
||||
"sale_stock",
|
||||
],
|
||||
"data": [
|
||||
"views/report_deliveryslip.xml",
|
||||
"views/report_stockpicking_operations.xml",
|
||||
"views/stock_report.xml",
|
||||
],
|
||||
"data": [],
|
||||
}
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
from . import stock_rule
|
||||
from . import sale_order_line
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
# Copyright 2023 Tecnativa - Carolina Fernandez
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import models
|
||||
|
||||
|
||||
class SaleOrderLine(models.Model):
|
||||
_inherit = "sale.order.line"
|
||||
|
||||
def write(self, vals):
|
||||
res = super().write(vals)
|
||||
if vals.get("name"):
|
||||
moves = self.env["stock.move"].search([("sale_line_id", "=", self.id)])
|
||||
if moves:
|
||||
moves.write({"description_picking": vals["name"]})
|
||||
return res
|
||||
@@ -31,5 +31,6 @@ class StockRule(models.Model):
|
||||
)
|
||||
if values.get("sale_line_id"):
|
||||
line = self.env["sale.order.line"].browse(values["sale_line_id"])
|
||||
res["description_picking"] = line.name
|
||||
res["name"] = line.name
|
||||
return res
|
||||
|
||||
@@ -4,3 +4,4 @@
|
||||
* Sergio Teruel
|
||||
* Ernesto Tejeda
|
||||
* Pilar Vargas
|
||||
* Carolina Fernandez
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
This module transfers the sales order line description to the picking, and
|
||||
This module transfers the sales order line description to the picking description, and
|
||||
allows to print such text on the picking reports.
|
||||
When the sales order line description is changed, picking description is updated.
|
||||
|
||||
@@ -3,8 +3,4 @@ To use this module, you need to:
|
||||
#. Create a sale order and set manual description in sale order lines.
|
||||
#. Confirm the order.
|
||||
#. Navigate to the delivery through the smart-button.
|
||||
#. You can print the reports with move name instead product name on the specific
|
||||
reports:
|
||||
|
||||
* Delivery Slip (Description).
|
||||
* Picking Operations (Description).
|
||||
#. You can check sales order line description is the same as description picking
|
||||
|
||||
@@ -424,6 +424,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
|
||||
<li>Sergio Teruel</li>
|
||||
<li>Ernesto Tejeda</li>
|
||||
<li>Pilar Vargas</li>
|
||||
<li>Carolina Fernandez</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# Copyright 2022 Tecnativa - Pedro M. Baeza
|
||||
# Copyright 2023 Tecnativa - Carolina Fernandez
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo.tests import common
|
||||
@@ -21,4 +22,11 @@ class TestStockPickingReportCustomDescription(common.TransactionCase):
|
||||
|
||||
def test_so_custom_description_transfer_to_picking(self):
|
||||
self.order.action_confirm()
|
||||
self.assertEqual(self.order.order_line.move_ids.name, "Custom description")
|
||||
self.assertEqual(
|
||||
self.order.order_line.move_ids.description_picking, "Custom description"
|
||||
)
|
||||
self.order.order_line.name = "Custom description 2"
|
||||
self.assertEqual(
|
||||
self.order.order_line.move_ids.description_picking,
|
||||
self.order.order_line.name,
|
||||
)
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
|
||||
<template
|
||||
id="report_delivery_document_description"
|
||||
inherit_id="stock.report_delivery_document"
|
||||
priority="99"
|
||||
primary="True"
|
||||
>
|
||||
<xpath
|
||||
expr="//table[@name='stock_move_table']//span[@t-field='move.product_id']"
|
||||
position="attributes"
|
||||
>
|
||||
<attribute name="t-field">move.name</attribute>
|
||||
</xpath>
|
||||
<xpath
|
||||
expr="//t[@t-foreach='packages']//t[@t-call='stock.stock_report_delivery_has_serial_move_line']"
|
||||
position="attributes"
|
||||
>
|
||||
<attribute
|
||||
name="t-call"
|
||||
>stock_picking_report_custom_description.stock_report_delivery_has_serial_move_line_description</attribute>
|
||||
</xpath>
|
||||
<xpath
|
||||
expr="//tr[@t-foreach='move_lines']//t[@t-call='stock.stock_report_delivery_has_serial_move_line']"
|
||||
position="attributes"
|
||||
>
|
||||
<attribute
|
||||
name="t-call"
|
||||
>stock_picking_report_custom_description.stock_report_delivery_has_serial_move_line_description</attribute>
|
||||
</xpath>
|
||||
<xpath
|
||||
expr="//t[@name='aggregated_move_lines']/..//t[@t-call='stock.stock_report_delivery_has_serial_move_line']"
|
||||
position="attributes"
|
||||
>
|
||||
<attribute
|
||||
name="t-call"
|
||||
>stock_picking_report_custom_description.stock_report_delivery_has_serial_move_line_description</attribute>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
<template
|
||||
id="stock_report_delivery_has_serial_move_line_description"
|
||||
inherit_id="stock.stock_report_delivery_has_serial_move_line"
|
||||
priority="99"
|
||||
primary="True"
|
||||
>
|
||||
<span t-field="move_line.product_id" position="attributes">
|
||||
<attribute name="t-field">move_line.move_id.name</attribute>
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<template id="report_deliveryslip_description">
|
||||
<t t-foreach="docs" t-as="o">
|
||||
<t
|
||||
t-call="stock_picking_report_custom_description.report_delivery_document_description"
|
||||
t-lang="o.partner_id.lang"
|
||||
/>
|
||||
</t>
|
||||
</template>
|
||||
|
||||
</odoo>
|
||||
@@ -1,18 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
|
||||
<template
|
||||
id="report_picking_description"
|
||||
inherit_id="stock.report_picking"
|
||||
priority="99"
|
||||
primary="True"
|
||||
>
|
||||
<xpath
|
||||
expr="//tr/td/span[@t-field='ml.product_id.display_name']"
|
||||
position="attributes"
|
||||
>
|
||||
<attribute name="t-field">ml.move_id.name</attribute>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
</odoo>
|
||||
@@ -1,29 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<record id="action_report_picking_description" model="ir.actions.report">
|
||||
<field name="name">Picking Operations (Description)</field>
|
||||
<field name="model">stock.picking</field>
|
||||
<field name="report_type">qweb-pdf</field>
|
||||
<field
|
||||
name="report_name"
|
||||
>stock_picking_report_custom_description.report_picking_description</field>
|
||||
<field
|
||||
name="report_file"
|
||||
>stock_picking_report_custom_description.report_picking_operations_description</field>
|
||||
<field name="binding_model_id" ref="stock.model_stock_picking" />
|
||||
<field name="binding_type">report</field>
|
||||
</record>
|
||||
<record id="action_report_delivery_description" model="ir.actions.report">
|
||||
<field name="name">Delivery Slip (Description)</field>
|
||||
<field name="model">stock.picking</field>
|
||||
<field name="report_type">qweb-pdf</field>
|
||||
<field
|
||||
name="report_name"
|
||||
>stock_picking_report_custom_description.report_deliveryslip_description</field>
|
||||
<field
|
||||
name="report_file"
|
||||
>stock_picking_report_custom_description.report_deliveryslip_description</field>
|
||||
<field name="binding_model_id" ref="stock.model_stock_picking" />
|
||||
<field name="binding_type">report</field>
|
||||
</record>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user