changes to delivery_carrier_partner_account
This commit is contained in:
parent
38b32ff892
commit
558313211c
2 changed files with 10 additions and 4 deletions
|
|
@ -138,13 +138,15 @@ class CarrierAccountMixin(models.AbstractModel):
|
||||||
if rec.carrier_account_id not in rec.valid_carrier_account_ids:
|
if rec.carrier_account_id not in rec.valid_carrier_account_ids:
|
||||||
rec.carrier_account_id = False
|
rec.carrier_account_id = False
|
||||||
if rec.delivery_billing_mode in ["prepaid", "ppc"]:
|
if rec.delivery_billing_mode in ["prepaid", "ppc"]:
|
||||||
rec.carrier_account_id = (
|
accounts = (
|
||||||
self.env["delivery.carrier.account"]
|
self.env["delivery.carrier.account"]
|
||||||
.search([("partner_id", "=", rec.sender_id.id)])
|
.search([("partner_id", "=", rec.sender_id.id)])
|
||||||
.filtered(
|
.filtered(
|
||||||
lambda account: account.delivery_carrier_id == rec.carrier_id
|
lambda account: account.delivery_carrier_id == rec.carrier_id
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
if accounts:
|
||||||
|
rec.carrier_account_id = accounts[0]
|
||||||
if (
|
if (
|
||||||
rec.delivery_billing_mode == "no charge"
|
rec.delivery_billing_mode == "no charge"
|
||||||
or not rec.delivery_billing_mode
|
or not rec.delivery_billing_mode
|
||||||
|
|
|
||||||
|
|
@ -28,9 +28,13 @@ class SalesOrder(models.Model):
|
||||||
for picking in rec.picking_ids.filtered(
|
for picking in rec.picking_ids.filtered(
|
||||||
lambda pick: pick.state not in ["done", "cancel"]
|
lambda pick: pick.state not in ["done", "cancel"]
|
||||||
):
|
):
|
||||||
picking.carrier_id = rec.carrier_id
|
picking.write(
|
||||||
picking.delivery_billing_mode = rec.delivery_billing_mode
|
{
|
||||||
picking.carrier_account_id = rec.carrier_account_id
|
"carrier_id": rec.carrier_id,
|
||||||
|
"carrier_account_id": rec.carrier_account_id,
|
||||||
|
"delivery_billing_mode": rec.delivery_billing_mode,
|
||||||
|
}
|
||||||
|
)
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def _create_delivery_line(self, carrier, price_unit):
|
def _create_delivery_line(self, carrier, price_unit):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue