Skip to content

Commit

Permalink
Merge PR #3834 into 14.0
Browse files Browse the repository at this point in the history
Signed-off-by aleuffre
  • Loading branch information
OCA-git-bot committed Jan 16, 2024
2 parents 2435f0a + 07b8796 commit b900344
Show file tree
Hide file tree
Showing 11 changed files with 186 additions and 27 deletions.
9 changes: 7 additions & 2 deletions l10n_it_delivery_note/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ITA - Documento di trasporto
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:86cc264b131150d0e14a593b955879a5dfe4ecfe7db4069f8ede4f8a416c9e20
!! source digest: sha256:7e84ab9e7d8b95fa408369675f7b6f005af32f694db0a5699a9f793ea45eb8f3
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand Down Expand Up @@ -73,6 +73,8 @@ To configure this module, go to:

Checking 'Use Advanced DN Features' allows you to manage more picking on one delivery note.

Checking 'Display Ref. Order in Delivery Note Report' or 'Display Ref. Customer in Delivery Note Report" enables in report fields relating DN line to SO (if applicable).

2. *Inventory → Configuration → Warehouse Management → Delivery Note Types*

In delivery note type you can specify if the product price have to be printed in the delivery note report/slip.
Expand Down Expand Up @@ -190,9 +192,12 @@ Contributors
* Andrea Piovesana <andrea.m.piovesana@gmail.com>
* Alex Comba <alex.comba@agilebg.com>
* `Ooops <https://www.ooops404.com>`_:

* Giovanni Serra <giovanni@gslab.it>
* Foresti Francesco <francesco.foresti@ooops404.com>
* Nextev Srl <odoo@nextev.it>
* `PyTech-SRL <info@pytech.it>`_:
* Alessandro Uffreduzzi <alessandro.uffreduzzi@pytech.it>
* Sebastiano Picchi <sebastiano.picchi@pytech.it>

Maintainers
~~~~~~~~~~~
Expand Down
1 change: 1 addition & 0 deletions l10n_it_delivery_note/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from . import account_invoice
from . import res_company
from . import res_config_settings
from . import res_partner
from . import sale_order
Expand Down
14 changes: 14 additions & 0 deletions l10n_it_delivery_note/models/res_company.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from odoo import fields, models


class ResCompany(models.Model):
_inherit = "res.company"

display_ref_order_dn_report = fields.Boolean(
"Display Ref. Order in Delivery Note Report",
default=False,
)
display_ref_customer_dn_report = fields.Boolean(
"Display Ref. Customer in Delivery Note Report",
default=False,
)
11 changes: 11 additions & 0 deletions l10n_it_delivery_note/models/res_config_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,14 @@ def _default_virtual_locations_root(self):
default=_default_virtual_locations_root,
config_parameter="stock.location.virtual_root",
)

display_ref_order_dn_report = fields.Boolean(
string="Display Ref. Order in Delivery Note Report",
related="company_id.display_ref_order_dn_report",
readonly=False,
)
display_ref_customer_dn_report = fields.Boolean(
string="Display Ref. Customer in Delivery Note Report",
related="company_id.display_ref_customer_dn_report",
readonly=False,
)
42 changes: 42 additions & 0 deletions l10n_it_delivery_note/models/stock_delivery_note.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,12 @@ def _domain_weight_uom(self):
store=True,
copy=False,
)
lines_have_so_number = fields.Boolean(
compute="_compute_lines_have_so_number",
)
lines_have_customer_ref = fields.Boolean(
compute="_compute_lines_have_customer_ref",
)

picking_ids = fields.One2many(
"stock.picking",
Expand Down Expand Up @@ -412,6 +418,20 @@ def _compute_access_url(self):
for dn in self:
dn.access_url = "/my/delivery-notes/%s" % (dn.id)

def _compute_lines_have_so_number(self):
for sdn in self:
sdn.lines_have_so_number = (
sdn.company_id.display_ref_order_dn_report
and any(line.sale_order_number for line in sdn.line_ids)
)

def _compute_lines_have_customer_ref(self):
for sdn in self:
sdn.lines_have_customer_ref = (
sdn.company_id.display_ref_customer_dn_report
and any(line.sale_order_client_ref for line in sdn.line_ids)
)

@api.onchange("picking_type")
def _onchange_picking_type(self):
if self.picking_type:
Expand Down Expand Up @@ -847,6 +867,16 @@ def _default_unit_uom(self):
sale_line_id = fields.Many2one(
"sale.order.line", related="move_id.sale_line_id", store=True, copy=False
)
sale_order_number = fields.Char(
"Sale Order Number",
compute="_compute_sale_order_number",
store=True,
)
sale_order_client_ref = fields.Char(
"Customer Reference",
compute="_compute_sale_order_client_ref",
store=True,
)
invoice_status = fields.Selection(
INVOICE_STATUSES,
string="Invoice status",
Expand All @@ -868,6 +898,18 @@ def _default_unit_uom(self):
def is_invoiceable(self):
return self.invoice_status == DOMAIN_INVOICE_STATUSES[1]

@api.depends("sale_line_id.order_id.name")
def _compute_sale_order_number(self):
for sdnl in self:
sdnl.sale_order_number = sdnl.sale_line_id.order_id.name or ""

@api.depends("sale_line_id.order_id.client_order_ref")
def _compute_sale_order_client_ref(self):
for sdnl in self:
sdnl.sale_order_client_ref = (
sdnl.sale_line_id.order_id.client_order_ref or ""
)

@api.onchange("product_id")
def _onchange_product_id(self):
if self.product_id:
Expand Down
2 changes: 2 additions & 0 deletions l10n_it_delivery_note/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ To configure this module, go to:

Checking 'Use Advanced DN Features' allows you to manage more picking on one delivery note.

Checking 'Display Ref. Order in Delivery Note Report' or 'Display Ref. Customer in Delivery Note Report" enables in report fields relating DN line to SO (if applicable).

2. *Inventory → Configuration → Warehouse Management → Delivery Note Types*

In delivery note type you can specify if the product price have to be printed in the delivery note report/slip.
Expand Down
5 changes: 4 additions & 1 deletion l10n_it_delivery_note/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
* Andrea Piovesana <andrea.m.piovesana@gmail.com>
* Alex Comba <alex.comba@agilebg.com>
* `Ooops <https://www.ooops404.com>`_:

* Giovanni Serra <giovanni@gslab.it>
* Foresti Francesco <francesco.foresti@ooops404.com>
* Nextev Srl <odoo@nextev.it>
* `PyTech-SRL <info@pytech.it>`_:
* Alessandro Uffreduzzi <alessandro.uffreduzzi@pytech.it>
* Sebastiano Picchi <sebastiano.picchi@pytech.it>
12 changes: 12 additions & 0 deletions l10n_it_delivery_note/report/report_delivery_note.xml
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,12 @@
<th t-if="doc.print_prices" class="text-right">
Taxes
</th>
<th t-if="doc.lines_have_so_number">
Ref. Order
</th>
<th t-if="doc.lines_have_customer_ref">
Ref. Customer
</th>
</tr>
</thead>

Expand Down Expand Up @@ -234,6 +240,12 @@
t-esc="', '.join(map(lambda t: (t.description or t.name), line.tax_ids))"
/>
</td>
<td t-if="doc.lines_have_so_number">
<span t-esc="line.sale_order_number" />
</td>
<td t-if="doc.lines_have_customer_ref">
<span t-esc="line.sale_order_client_ref" />
</td>
</t>
<t t-else="">
<td colspan="6">
Expand Down
51 changes: 27 additions & 24 deletions l10n_it_delivery_note/static/description/index.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?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 @@ -366,7 +367,7 @@ <h1 class="title">ITA - Documento di trasporto</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:86cc264b131150d0e14a593b955879a5dfe4ecfe7db4069f8ede4f8a416c9e20
!! source digest: sha256:7e84ab9e7d8b95fa408369675f7b6f005af32f694db0a5699a9f793ea45eb8f3
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" 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 image-reference" 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 image-reference" href="https://github.com/OCA/l10n-italy/tree/14.0/l10n_it_delivery_note"><img alt="OCA/l10n-italy" src="https://img.shields.io/badge/github-OCA%2Fl10n--italy-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/l10n-italy-14-0/l10n-italy-14-0-l10n_it_delivery_note"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/l10n-italy&amp;target_branch=14.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><strong>English</strong></p>
Expand Down Expand Up @@ -415,6 +416,7 @@ <h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
<ol class="arabic">
<li><p class="first"><em>Inventory → Configuration → Settings - Delivery Notes</em></p>
<p>Checking ‘Use Advanced DN Features’ allows you to manage more picking on one delivery note.</p>
<p>Checking ‘Display Ref. Order in Delivery Note Report’ or ‘Display Ref. Customer in Delivery Note Report” enables in report fields relating DN line to SO (if applicable).</p>
</li>
<li><p class="first"><em>Inventory → Configuration → Warehouse Management → Delivery Note Types</em></p>
<p>In delivery note type you can specify if the product price have to be printed in the delivery note report/slip.</p>
Expand Down Expand Up @@ -507,33 +509,34 @@ <h2><a class="toc-backref" href="#toc-entry-9">Authors</a></h2>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#toc-entry-10">Contributors</a></h2>
<ul>
<li><p class="first">Riccardo Bellanova &lt;<a class="reference external" href="mailto:r.bellanova&#64;apuliasoftware.it">r.bellanova&#64;apuliasoftware.it</a>&gt;</p>
</li>
<li><p class="first">Matteo Bilotta &lt;<a class="reference external" href="mailto:mbilotta&#64;linkeurope.it">mbilotta&#64;linkeurope.it</a>&gt;</p>
</li>
<li><p class="first">Giuseppe Borruso &lt;<a class="reference external" href="mailto:gconte&#64;dinamicheaziendali.it">gconte&#64;dinamicheaziendali.it</a>&gt;</p>
</li>
<li><p class="first">Marco Calcagni &lt;<a class="reference external" href="mailto:mcalcagni&#64;dinamicheaziendali.it">mcalcagni&#64;dinamicheaziendali.it</a>&gt;</p>
</li>
<li><p class="first">Marco Colombo &lt;<a class="reference external" href="mailto:marco.colombo&#64;gmail.com">marco.colombo&#64;gmail.com</a>&gt;</p>
</li>
<li><p class="first">Gianmarco Conte &lt;<a class="reference external" href="mailto:gconte&#64;dinamicheaziendali.it">gconte&#64;dinamicheaziendali.it</a>&gt;</p>
</li>
<li><p class="first">Letizia Freda &lt;<a class="reference external" href="mailto:letizia.freda&#64;netfarm.it">letizia.freda&#64;netfarm.it</a>&gt;</p>
</li>
<li><p class="first">Andrea Piovesana &lt;<a class="reference external" href="mailto:andrea.m.piovesana&#64;gmail.com">andrea.m.piovesana&#64;gmail.com</a>&gt;</p>
</li>
<li><p class="first">Alex Comba &lt;<a class="reference external" href="mailto:alex.comba&#64;agilebg.com">alex.comba&#64;agilebg.com</a>&gt;</p>
</li>
<li><p class="first"><a class="reference external" href="https://www.ooops404.com">Ooops</a>:</p>
<blockquote>
<ul class="simple">
<li>Riccardo Bellanova &lt;<a class="reference external" href="mailto:r.bellanova&#64;apuliasoftware.it">r.bellanova&#64;apuliasoftware.it</a>&gt;</li>
<li>Matteo Bilotta &lt;<a class="reference external" href="mailto:mbilotta&#64;linkeurope.it">mbilotta&#64;linkeurope.it</a>&gt;</li>
<li>Giuseppe Borruso &lt;<a class="reference external" href="mailto:gconte&#64;dinamicheaziendali.it">gconte&#64;dinamicheaziendali.it</a>&gt;</li>
<li>Marco Calcagni &lt;<a class="reference external" href="mailto:mcalcagni&#64;dinamicheaziendali.it">mcalcagni&#64;dinamicheaziendali.it</a>&gt;</li>
<li>Marco Colombo &lt;<a class="reference external" href="mailto:marco.colombo&#64;gmail.com">marco.colombo&#64;gmail.com</a>&gt;</li>
<li>Gianmarco Conte &lt;<a class="reference external" href="mailto:gconte&#64;dinamicheaziendali.it">gconte&#64;dinamicheaziendali.it</a>&gt;</li>
<li>Letizia Freda &lt;<a class="reference external" href="mailto:letizia.freda&#64;netfarm.it">letizia.freda&#64;netfarm.it</a>&gt;</li>
<li>Andrea Piovesana &lt;<a class="reference external" href="mailto:andrea.m.piovesana&#64;gmail.com">andrea.m.piovesana&#64;gmail.com</a>&gt;</li>
<li>Alex Comba &lt;<a class="reference external" href="mailto:alex.comba&#64;agilebg.com">alex.comba&#64;agilebg.com</a>&gt;</li>
<li><dl class="first docutils">
<dt><a class="reference external" href="https://www.ooops404.com">Ooops</a>:</dt>
<dd><ul class="first last">
<li>Giovanni Serra &lt;<a class="reference external" href="mailto:giovanni&#64;gslab.it">giovanni&#64;gslab.it</a>&gt;</li>
<li>Foresti Francesco &lt;<a class="reference external" href="mailto:francesco.foresti&#64;ooops404.com">francesco.foresti&#64;ooops404.com</a>&gt;</li>
</ul>
</blockquote>
</dd>
</dl>
</li>
<li><p class="first">Nextev Srl &lt;<a class="reference external" href="mailto:odoo&#64;nextev.it">odoo&#64;nextev.it</a>&gt;</p>
<li>Nextev Srl &lt;<a class="reference external" href="mailto:odoo&#64;nextev.it">odoo&#64;nextev.it</a>&gt;</li>
<li><dl class="first docutils">
<dt><a class="reference external" href="mailto:info&#64;pytech.it">PyTech-SRL</a>:</dt>
<dd><ul class="first last">
<li>Alessandro Uffreduzzi &lt;<a class="reference external" href="mailto:alessandro.uffreduzzi&#64;pytech.it">alessandro.uffreduzzi&#64;pytech.it</a>&gt;</li>
<li>Sebastiano Picchi &lt;<a class="reference external" href="mailto:sebastiano.picchi&#64;pytech.it">sebastiano.picchi&#64;pytech.it</a>&gt;</li>
</ul>
</dd>
</dl>
</li>
</ul>
</div>
Expand Down
32 changes: 32 additions & 0 deletions l10n_it_delivery_note/views/res_config_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,38 @@
<field name="virtual_locations_root" />
</div>
</div>
<div
class="col-12 col-lg-6 o_setting_box"
attrs="{'invisible': [('group_use_advanced_delivery_notes', '=', False)]}"
>
<div class="o_setting_left_pane">
<field name="display_ref_order_dn_report" />
</div>
<div class="o_setting_right_pane">
<label for="display_ref_order_dn_report" />
<div class="text-muted">
<p>
Prints Sale Order numbers on DN report (if there are any)
</p>
</div>
</div>
</div>
<div
class="col-12 col-lg-6 o_setting_box"
attrs="{'invisible': [('group_use_advanced_delivery_notes', '=', False)]}"
>
<div class="o_setting_left_pane">
<field name="display_ref_customer_dn_report" />
</div>
<div class="o_setting_right_pane">
<label for="display_ref_customer_dn_report" />
<div class="text-muted">
<p>
Prints Customer References on DN report (if there are any)
</p>
</div>
</div>
</div>
</div>
</xpath>
</field>
Expand Down
34 changes: 34 additions & 0 deletions l10n_it_delivery_note/views/stock_delivery_note.xml
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,40 @@
'readonly': [('sale_line_id', '!=', False)]}"
widget="many2many_tags"
/>
<field
name="sale_order_number"
attrs="
{
'column_invisible': [(
'parent.show_product_information',
'=',
False
)],
'readonly': [(
'sale_line_id',
'!=',
False
)]
}"
optional="hide"
/>
<field
name="sale_order_client_ref"
attrs="
{
'column_invisible': [(
'parent.show_product_information',
'=',
False
)],
'readonly': [(
'sale_line_id',
'!=',
False
)]
}"
optional="hide"
/>
<field name="company_id" invisible="1" />
</tree>
<form>
Expand Down

0 comments on commit b900344

Please sign in to comment.