[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#122328 X-original-commit: 8a45ae0842a6ac08b321e44113896581d9af42bd Signed-off-by: Josse Colpaert <jco@odoo.com> Signed-off-by: Grazioso Andrea (agr) <agr@odoo.com>
This commit is contained in:
committed by
Andrea Grazioso (agr-odoo)
parent
4d32efba90
commit
e6d4ab62e9
@@ -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), '&', ('picking_type_code', '=', 'outgoing'), ('country_code', '=', 'IT')]}</attribute>
|
||||
<attribute name="attrs">{'invisible': ['|', ('l10n_it_show_print_ddt_button', '=', True), '&', ('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')]}">
|
||||
|
||||
Reference in New Issue
Block a user