Files
Alexis de Lattre 8e5d3b8a74 [MIG] purchase_stock_usability_akretion to v18
incoterm_id is a field of purchase module, not purchase_stock ; so move
the inherit of this field from purchase_stock_usability_akretion to
purchase_usability_akretion
2024-12-30 12:47:30 +01:00

27 lines
1.0 KiB
Python

# Copyright 2015-2024 Akretion France (https://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
class PurchaseOrder(models.Model):
_inherit = 'purchase.order'
picking_type_id = fields.Many2one(tracking=True)
incoterm_location = fields.Char(tracking=True)
# inherit compute method of the field delivery_partner_id
# defined in purchase_usability_akretion
@api.depends('dest_address_id', 'picking_type_id')
def _compute_delivery_partner_id(self):
for rec in self:
delivery_partner_id = False
if rec.dest_address_id:
delivery_partner_id = rec.dest_address_id
elif (
rec.picking_type_id.warehouse_id and
rec.picking_type_id.warehouse_id.partner_id):
delivery_partner_id = rec.picking_type_id.warehouse_id.partner_id
rec.delivery_partner_id = delivery_partner_id