Skip to content
Snippets Groups Projects
Commit 8a45ae08 authored by Paolo Gatti (pgi)'s avatar Paolo Gatti (pgi) Committed by Andrea Grazioso (agr-odoo)
Browse files

[FIX] l10n_it_stock_ddt: Print not printing DDT in case of Dropshipping


The visibility of the "Print" DDT button wasn't taking into
consideration the dropshipping case.

closes odoo/odoo#122034

Signed-off-by: default avatarJosse Colpaert <jco@odoo.com>
Signed-off-by: default avatarGrazioso Andrea (agr) <agr@odoo.com>
parent b8fe190b
No related branches found
No related tags found
No related merge requests found
......@@ -21,6 +21,32 @@ class StockPicking(models.Model):
l10n_it_transport_method_details = fields.Char('Transport Note')
l10n_it_parcels = fields.Integer(string="Parcels", default=1)
l10n_it_ddt_number = fields.Char('DDT Number', readonly=True)
l10n_it_show_print_ddt_button = fields.Boolean(compute="_compute_l10n_it_show_print_ddt_button")
@api.depends('country_code',
'picking_type_code',
'state',
'is_locked',
'move_ids',
'location_id',
'location_dest_id')
def _compute_l10n_it_show_print_ddt_button(self):
# Enable printing the DDT for done outgoing shipments
# or dropshipping (picking going from supplier to customer)
for picking in self:
picking.l10n_it_show_print_ddt_button = (
picking.country_code == 'IT'
and picking.state == 'done'
and picking.is_locked
and (picking.picking_type_code == 'outgoing'
or (
picking.move_ids_without_package
and picking.move_ids_without_package[0].partner_id
and picking.location_id.usage == 'supplier'
and picking.location_dest_id.usage == 'customer'
)
)
)
def _action_done(self):
super(StockPicking, self)._action_done()
......
......@@ -7,12 +7,13 @@
<field name="arch" type="xml">
<xpath expr="//button[@name='do_print_picking']" position="after">
<field name="country_code" invisible="1"/>
<field name="l10n_it_show_print_ddt_button" invisible="1"/>
<button name="%(l10n_it_stock_ddt.action_report_ddt)d" type="action" string="Print"
attrs="{'invisible': ['|', '|', '|', ('picking_type_code', '!=', 'outgoing'), ('country_code', '!=', 'IT'), ('state', '!=', 'done'), ('is_locked', '=', False)]}"
attrs="{'invisible': [('l10n_it_show_print_ddt_button', '=', False)]}"
groups="base.group_user"/>
</xpath>
<xpath expr="//button[@name='%(stock.action_report_delivery)d']" position="attributes">
<attribute name="attrs">{'invisible': ['|', ('state', '!=', 'done'), '|', ('is_locked', '=', False), '&amp;', ('picking_type_code', '=', 'outgoing'), ('country_code', '=', 'IT')]}</attribute>
<attribute name="attrs">{'invisible': ['|', ('l10n_it_show_print_ddt_button', '=', True), '&amp;', ('picking_type_code', '=', 'outgoing'), ('country_code', '=', 'IT')]}</attribute>
</xpath>
<group name='carrier_data' position="after">
<group string="DDT Information" attrs="{'invisible': ['|', ('country_code', '!=', 'IT'), ('picking_type_code', '!=', 'outgoing')]}">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment