mirror of
https://github.com/OCA/stock-logistics-reporting.git
synced 2025-02-16 17:13:21 +02:00
[FIX] stock_picking_report_custom_description: Transfer line description to move
Since v14, the SO line custom description is not transferred to the stock.move name, so we need to do such transfer in this module, as the main purpose of it is to print custom texts from SO.
This commit is contained in:
@@ -19,13 +19,14 @@ Stock Picking Report Custom Description
|
||||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
||||
:target: https://translation.odoo-community.org/projects/stock-logistics-reporting-14-0/stock-logistics-reporting-14-0-stock_picking_report_custom_description
|
||||
: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/14.0
|
||||
:alt: Try me on Runbot
|
||||
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
|
||||
:target: https://runboat.odoo-community.org/webui/builds.html?repo=OCA/stock-logistics-reporting&target_branch=14.0
|
||||
:alt: Try me on Runboat
|
||||
|
||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||
|
||||
This module allows to print moves description in picking reports.
|
||||
This module transfers the sales order line description to the picking, and
|
||||
allows to print such text on the picking reports.
|
||||
|
||||
**Table of contents**
|
||||
|
||||
@@ -38,8 +39,13 @@ Usage
|
||||
To use this module, you need to:
|
||||
|
||||
#. Create a sale order and set manual description in sale order lines.
|
||||
#. Go to *Inventory > Deliveries* and you can print the reports with move name
|
||||
instead product name.
|
||||
#. 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).
|
||||
|
||||
Bug Tracker
|
||||
===========
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
from . import models
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
"maintainers": ["carlosdauden"],
|
||||
"license": "AGPL-3",
|
||||
"depends": [
|
||||
"stock",
|
||||
"sale_stock",
|
||||
],
|
||||
"data": [
|
||||
"views/report_deliveryslip.xml",
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
from . import stock_rule
|
||||
35
stock_picking_report_custom_description/models/stock_rule.py
Normal file
35
stock_picking_report_custom_description/models/stock_rule.py
Normal file
@@ -0,0 +1,35 @@
|
||||
# Copyright 2022 Tecnativa - Pedro M. Baeza
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import models
|
||||
|
||||
|
||||
class StockRule(models.Model):
|
||||
_inherit = "stock.rule"
|
||||
|
||||
def _get_stock_move_values(
|
||||
self,
|
||||
product_id,
|
||||
product_qty,
|
||||
product_uom,
|
||||
location_id,
|
||||
name,
|
||||
origin,
|
||||
company_id,
|
||||
values,
|
||||
):
|
||||
"""Transfer the SO line description to the move name."""
|
||||
res = super()._get_stock_move_values(
|
||||
product_id,
|
||||
product_qty,
|
||||
product_uom,
|
||||
location_id,
|
||||
name,
|
||||
origin,
|
||||
company_id,
|
||||
values,
|
||||
)
|
||||
if values.get("sale_line_id"):
|
||||
line = self.env["sale.order.line"].browse(values["sale_line_id"])
|
||||
res["name"] = line.name
|
||||
return res
|
||||
@@ -1 +1,2 @@
|
||||
This module allows to print moves description in picking reports.
|
||||
This module transfers the sales order line description to the picking, and
|
||||
allows to print such text on the picking reports.
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
To use this module, you need to:
|
||||
|
||||
#. Create a sale order and set manual description in sale order lines.
|
||||
#. Go to *Inventory > Deliveries* and you can print the reports with move name
|
||||
instead product name.
|
||||
#. 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).
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
|
||||
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
|
||||
<title>Stock Picking Report Custom Description</title>
|
||||
<style type="text/css">
|
||||
|
||||
@@ -367,8 +367,9 @@ 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="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.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/14.0/stock_picking_report_custom_description"><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-14-0/stock-logistics-reporting-14-0-stock_picking_report_custom_description"><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/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
||||
<p>This module allows to print moves description in picking reports.</p>
|
||||
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.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/14.0/stock_picking_report_custom_description"><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-14-0/stock-logistics-reporting-14-0-stock_picking_report_custom_description"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runboat.odoo-community.org/webui/builds.html?repo=OCA/stock-logistics-reporting&target_branch=14.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
|
||||
<p>This module transfers the sales order line description to the picking, and
|
||||
allows to print such text on the picking reports.</p>
|
||||
<p><strong>Table of contents</strong></p>
|
||||
<div class="contents local topic" id="contents">
|
||||
<ul class="simple">
|
||||
@@ -387,8 +388,14 @@ ul.auto-toc {
|
||||
<p>To use this module, you need to:</p>
|
||||
<ol class="arabic simple">
|
||||
<li>Create a sale order and set manual description in sale order lines.</li>
|
||||
<li>Go to <em>Inventory > Deliveries</em> and you can print the reports with move name
|
||||
instead product name.</li>
|
||||
<li>Confirm the order.</li>
|
||||
<li>Navigate to the delivery through the smart-button.</li>
|
||||
<li>You can print the reports with move name instead product name on the specific
|
||||
reports:<ul>
|
||||
<li>Delivery Slip (Description).</li>
|
||||
<li>Picking Operations (Description).</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
<div class="section" id="bug-tracker">
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
from . import test_stock_picking_report_custom_description
|
||||
@@ -0,0 +1,24 @@
|
||||
# Copyright 2022 Tecnativa - Pedro M. Baeza
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo.tests import common
|
||||
|
||||
|
||||
class TestStockPickingReportCustomDescription(common.SavepointCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
cls.customer = cls.env["res.partner"].create({"name": "Test customer"})
|
||||
cls.product = cls.env["product.product"].create(
|
||||
{"name": "Test product", "type": "product"}
|
||||
)
|
||||
order_form = common.Form(cls.env["sale.order"])
|
||||
order_form.partner_id = cls.customer
|
||||
with order_form.order_line.new() as line_form:
|
||||
line_form.product_id = cls.product
|
||||
line_form.name = "Custom description"
|
||||
cls.order = order_form.save()
|
||||
|
||||
def test_so_custom_description_transfer_to_picking(self):
|
||||
self.order.action_confirm()
|
||||
self.assertEqual(self.order.order_line.move_ids.name, "Custom description")
|
||||
Reference in New Issue
Block a user