Skip to content

Commit

Permalink
Merge PR #4280 into 14.0
Browse files Browse the repository at this point in the history
Signed-off-by francesco-ooops
  • Loading branch information
OCA-git-bot committed Jul 22, 2024
2 parents 1a77b80 + 0fb7f19 commit 37041d7
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 56 deletions.
40 changes: 0 additions & 40 deletions l10n_it_delivery_note/models/sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@
class SaleOrder(models.Model):
_inherit = "sale.order"

delivery_note_ids = fields.Many2many(
"stock.delivery.note", compute="_compute_delivery_notes"
)
delivery_note_count = fields.Integer(compute="_compute_delivery_notes")

default_transport_condition_id = fields.Many2one(
"stock.picking.transport.condition",
string="Condition of transport",
Expand Down Expand Up @@ -57,15 +52,6 @@ def onchange_partner_id_shipping_info(self):

self.update(values)

def _compute_delivery_notes(self):
for order in self:
delivery_notes = order.order_line.mapped(
"delivery_note_line_ids.delivery_note_id"
)

order.delivery_note_ids = delivery_notes
order.delivery_note_count = len(delivery_notes)

def _assign_delivery_notes_invoices(self, invoice_ids):
order_lines = self.mapped("order_line").filtered(
lambda l: l.is_invoiced and l.delivery_note_line_ids
Expand Down Expand Up @@ -126,32 +112,6 @@ def _create_invoices(self, grouped=False, final=False, date=None):

return invoice_ids

def goto_delivery_notes(self, **kwargs):
delivery_notes = self.mapped("delivery_note_ids")
action = self.env["ir.actions.act_window"]._for_xml_id(
"l10n_it_delivery_note.stock_delivery_note_action"
)
action.update(kwargs)

if len(delivery_notes) > 1:
action["domain"] = [("id", "in", delivery_notes.ids)]

elif len(delivery_notes) == 1:
action["views"] = [
(
self.env.ref(
"l10n_it_delivery_note.stock_delivery_note_form_view"
).id,
"form",
)
]
action["res_id"] = delivery_notes.id

else:
action = {"type": "ir.actions.act_window_close"}

return action


class SaleOrderLine(models.Model):
_inherit = "sale.order.line"
Expand Down
2 changes: 1 addition & 1 deletion l10n_it_delivery_note/wizard/sale_advance_payment_inv.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class SaleAdvancePaymentInv(models.TransientModel):
_inherit = "sale.advance.payment.inv"

def _default_step(self):
states = self.sale_order_ids.mapped("delivery_note_ids.state")
states = self.sale_order_ids.mapped("picking_ids.delivery_note_id.state")

if any(s == "draft" for s in states):
return DOMAIN_WIZARD_STEPS[1]
Expand Down
17 changes: 13 additions & 4 deletions l10n_it_delivery_note_order_link/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,19 @@ promote its widespread use.
.. |maintainer-andreampiovesana| image:: https://github.com/andreampiovesana.png?size=40px
:target: https://github.com/andreampiovesana
:alt: andreampiovesana

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-andreampiovesana|
.. |maintainer-aleuffre| image:: https://github.com/aleuffre.png?size=40px
:target: https://github.com/aleuffre
:alt: aleuffre
.. |maintainer-renda-dev| image:: https://github.com/renda-dev.png?size=40px
:target: https://github.com/renda-dev
:alt: renda-dev
.. |maintainer-PicchiSeba| image:: https://github.com/PicchiSeba.png?size=40px
:target: https://github.com/PicchiSeba
:alt: PicchiSeba

Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-andreampiovesana| |maintainer-aleuffre| |maintainer-renda-dev| |maintainer-PicchiSeba|

This module is part of the `OCA/l10n-italy <https://github.com/OCA/l10n-italy/tree/14.0/l10n_it_delivery_note_order_link>`_ project on GitHub.

Expand Down
2 changes: 1 addition & 1 deletion l10n_it_delivery_note_order_link/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"website": "https://github.com/OCA/l10n-italy",
"version": "14.0.1.0.1",
"license": "AGPL-3",
"maintainers": ["andreampiovesana"],
"maintainers": ["andreampiovesana", "aleuffre", "renda-dev", "PicchiSeba"],
"category": "Localization/Italy",
"depends": [
"purchase_stock",
Expand Down
26 changes: 23 additions & 3 deletions l10n_it_delivery_note_order_link/models/sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,29 @@ class SaleOrder(models.Model):

def _compute_delivery_notes(self):
for order in self:
delivery_notes = order.order_line.mapped(
"delivery_note_line_ids.delivery_note_id"
)
delivery_notes = order.picking_ids.mapped("delivery_note_id")

order.delivery_note_ids = delivery_notes
order.delivery_note_count = len(delivery_notes)

def goto_delivery_notes(self, **kwargs):
delivery_notes = self.mapped("delivery_note_ids")

action = self.env["ir.actions.act_window"]._for_xml_id(
"l10n_it_delivery_note.stock_delivery_note_action"
)
action.update(kwargs)
if len(delivery_notes) > 1:
action["domain"] = [("id", "in", delivery_notes.ids)]
elif len(delivery_notes) == 1:
action["views"] = [
(
self.env.ref(
"l10n_it_delivery_note.stock_delivery_note_form_view"
).id,
"form",
)
]
action["res_id"] = delivery_notes.id

return action
16 changes: 9 additions & 7 deletions l10n_it_delivery_note_order_link/static/description/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?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 All @@ -9,10 +8,11 @@

/*
:Author: David Goodger ([email protected])
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.

Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.

See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
Expand Down Expand Up @@ -275,7 +275,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: grey; } /* line numbers */
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
Expand All @@ -301,7 +301,7 @@
span.pre {
white-space: pre }

span.problematic {
span.problematic, pre.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -428,12 +428,14 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<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>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<p><a class="reference external image-reference" href="https://github.com/andreampiovesana"><img alt="andreampiovesana" src="https://github.com/andreampiovesana.png?size=40px" /></a></p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainers</a>:</p>
<p><a class="reference external image-reference" href="https://github.com/andreampiovesana"><img alt="andreampiovesana" src="https://github.com/andreampiovesana.png?size=40px" /></a> <a class="reference external image-reference" href="https://github.com/aleuffre"><img alt="aleuffre" src="https://github.com/aleuffre.png?size=40px" /></a> <a class="reference external image-reference" href="https://github.com/renda-dev"><img alt="renda-dev" src="https://github.com/renda-dev.png?size=40px" /></a> <a class="reference external image-reference" href="https://github.com/PicchiSeba"><img alt="PicchiSeba" src="https://github.com/PicchiSeba.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/l10n-italy/tree/14.0/l10n_it_delivery_note_order_link">OCA/l10n-italy</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>
Expand Down

0 comments on commit 37041d7

Please sign in to comment.