[FIX] l10n_it_stock_ddt: only get ddt if outgoing picking type
When an Italian e-invoice is generated, it will include DDT sequence of
DDT stock moves. If those stock moves have picking type different of
'outgoing' (eg: Dropshipping), the picking type does not have DDT
sequence leading to a traceback.
Now we only consider DDT stock moves if they have the outgoing picking type.
Steps to reproduce:
- Create local database
- Install accounting, purchase, l10n_it_stock_ddt
- Switch to Italian company
- Activate dropshipping in settings
- Put Fattura Elettronica mode in "test" in settings ("demo" mode should be fine to)
- Create a a storable dropship product
- Create a sale order with dropship product and confirm it
- Click on purchase smart button and confirm purchase
- Validate to dropship transfer
- Create invoice from SO and confirm it (should get the DDT smart button)
- Click "Process now" on top of invoice => Traceback
opw-3544775
closes odoo/odoo#143461
X-original-commit: 27541b1e9b80db5234aff3a2591d1eb1ce9629a0
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
This commit is contained in:
@@ -47,7 +47,8 @@ class AccountMove(models.Model):
|
||||
invoice_line_pickings = {}
|
||||
for line in self.invoice_line_ids.filtered(lambda l: l.display_type not in ('line_note', 'line_section')):
|
||||
line_count += 1
|
||||
done_moves_related = line.sale_line_ids.mapped('move_ids').filtered(lambda m: m.state == 'done' and m.location_dest_id.usage == 'customer')
|
||||
done_moves_related = line.sale_line_ids.mapped('move_ids').filtered(
|
||||
lambda m: m.state == 'done' and m.location_dest_id.usage == 'customer' and m.picking_type_id.code == 'outgoing')
|
||||
if len(done_moves_related) <= 1:
|
||||
if done_moves_related and line_count not in invoice_line_pickings.get(done_moves_related.picking_id, []):
|
||||
invoice_line_pickings.setdefault(done_moves_related.picking_id, []).append(line_count)
|
||||
|
||||
Reference in New Issue
Block a user