new module sale_mandatory_customer_reference and small fix to delivery_carrier_partner_account
This commit is contained in:
parent
3c9835270e
commit
b627b1f57c
1 changed files with 8 additions and 3 deletions
|
|
@ -24,6 +24,9 @@ class Partner(models.Model):
|
|||
res = super().write(vals)
|
||||
if update_default_carrier and self.carrier_account_ids:
|
||||
self.default_carrier_account_id = self.carrier_account_ids[0]
|
||||
self.property_delivery_carrier_id = (
|
||||
self.default_carrier_account_id.delivery_carrier_id
|
||||
)
|
||||
return res
|
||||
|
||||
@api.model_create_multi
|
||||
|
|
@ -41,9 +44,11 @@ class Partner(models.Model):
|
|||
)
|
||||
if own_accounts:
|
||||
return own_accounts[0]
|
||||
commercial_patner_accounts = self.commercial_partner_id.carrier_account_ids.filtered(
|
||||
lambda account: account.delivery_carrier_id == carrier
|
||||
commercial_patner_accounts = (
|
||||
self.commercial_partner_id.carrier_account_ids.filtered(
|
||||
lambda account: account.delivery_carrier_id == carrier
|
||||
)
|
||||
)
|
||||
if commercial_patner_accounts:
|
||||
return commercial_patner_accounts[0]
|
||||
return self.env["delivery.carrier.account"]
|
||||
return self.env["delivery.carrier.account"]
|
||||
|
|
|
|||
Loading…
Reference in a new issue