Skip to content

Commit

Permalink
Merge PR #2785 into 14.0
Browse files Browse the repository at this point in the history
Signed-off-by aleuffre
  • Loading branch information
OCA-git-bot committed Feb 23, 2024
2 parents 2129e67 + d44a5a2 commit 88cd97e
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions l10n_it_delivery_note/models/stock_picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,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.get_warehouse()
dest_warehouse_id = dest_location_id.get_warehouse()
Expand All @@ -397,16 +398,18 @@ 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."
)
src_partner_id = (
self.company_id.partner_id
if picking_type_code == ["outgoing"]
else partner_id
)

elif not dest_partner_id:
dest_partner_id = partner_id
if not dest_partner_id:
dest_partner_id = (
self.company_id.partner_id
if picking_type_code == ["incoming"]
else partner_id
)

return (src_partner_id, dest_partner_id)

Expand Down

0 comments on commit 88cd97e

Please sign in to comment.