Skip to content

Commit

Permalink
[FIX] l10n_it_delivery_note: fix partner ddt
Browse files Browse the repository at this point in the history
  • Loading branch information
Borruso committed Dec 1, 2023
1 parent 97459ef commit c1334ed
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions l10n_it_delivery_note/models/stock_picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ def _get_partners(self):
partner_id = self.mapped("partner_id")
src_location_id = self.mapped("location_id")
dest_location_id = self.mapped("location_dest_id")
picking_type_code = self.mapped("picking_type_code")

src_warehouse_id = src_location_id.warehouse_id
dest_warehouse_id = dest_location_id.warehouse_id
Expand All @@ -383,16 +384,16 @@ def _get_partners(self):
dest_partner_id = dest_warehouse_id.partner_id

if not src_partner_id:
src_partner_id = partner_id

if not dest_partner_id:
raise ValueError(
"Fields 'src_partner_id' and 'dest_partner_id' "
"cannot be both unset."
)

elif not dest_partner_id:
dest_partner_id = partner_id
if picking_type_code == ["outgoing"]:
src_partner_id = self.company_id.partner_id

Check warning on line 388 in l10n_it_delivery_note/models/stock_picking.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_delivery_note/models/stock_picking.py#L388

Added line #L388 was not covered by tests
else:
src_partner_id = partner_id or self.company_id.partner_id

Check warning on line 390 in l10n_it_delivery_note/models/stock_picking.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_delivery_note/models/stock_picking.py#L390

Added line #L390 was not covered by tests

if not dest_partner_id:
if picking_type_code == ["incoming"]:
dest_partner_id = self.company_id.partner_id

Check warning on line 394 in l10n_it_delivery_note/models/stock_picking.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_delivery_note/models/stock_picking.py#L394

Added line #L394 was not covered by tests
else:
dest_partner_id = partner_id or self.company_id.partner_id

return (src_partner_id, dest_partner_id)

Expand Down

0 comments on commit c1334ed

Please sign in to comment.