From 9f48ffc0c5c61af944be099b216dbecee083407a Mon Sep 17 00:00:00 2001 From: Mmequignon Date: Mon, 18 Nov 2024 14:53:17 +0100 Subject: [PATCH] WIP --- .../migrations/14.0.3.0.0/post-migration.py | 31 ++++++++++--------- .../models/purchase_order.py | 6 ++-- .../models/res_partner.py | 13 ++++---- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/purchase_partner_incoterm/migrations/14.0.3.0.0/post-migration.py b/purchase_partner_incoterm/migrations/14.0.3.0.0/post-migration.py index 387e1be554d..583db2830cd 100644 --- a/purchase_partner_incoterm/migrations/14.0.3.0.0/post-migration.py +++ b/purchase_partner_incoterm/migrations/14.0.3.0.0/post-migration.py @@ -5,21 +5,22 @@ def migrate(cr, version): - env = api.Environment(cr, SUPERUSER_ID, {}) + return + # env = api.Environment(cr, SUPERUSER_ID, {}) - children = env["res.partner"].search( - [["commercial_partner_id", "!=", False], ["purchase_incoterm_id", "!=", False]] - ) + # children = env["res.partner"].search( + # [["commercial_partner_id", "!=", False], ["purchase_incoterm_id", "!=", False]] + # ) - seen = env["res.partner"].browse(False) + # seen = env["res.partner"].browse(False) - for child in children: - if child.parent_id.purchase_incoterm_id: - continue - if child.parent_id in seen: - continue - seen |= child.parent_id - child.parent_id.purchase_incoterm_id = child.purchase_incoterm_id - child.parent_id.purchase_incoterm_address_id = ( - child.purchase_incoterm_address_id - ) + # for child in children: + # if child.parent_id.purchase_incoterm_id: + # continue + # if child.parent_id in seen: + # continue + # seen |= child.parent_id + # child.parent_id.purchase_incoterm_id = child.purchase_incoterm_id + # child.parent_id.purchase_incoterm_address_id = ( + # child.purchase_incoterm_address_id + # ) diff --git a/purchase_partner_incoterm/models/purchase_order.py b/purchase_partner_incoterm/models/purchase_order.py index 1d2cbee8d75..d3ac08a3304 100644 --- a/purchase_partner_incoterm/models/purchase_order.py +++ b/purchase_partner_incoterm/models/purchase_order.py @@ -15,8 +15,6 @@ class PurchaseOrder(models.Model): @api.onchange("partner_id") def onchange_partner_id(self): res = super().onchange_partner_id() - self.incoterm_id = self.partner_id.commercial_partner_id.purchase_incoterm_id - self.incoterm_address_id = ( - self.partner_id.commercial_partner_id.purchase_incoterm_address_id - ) + self.incoterm_id = self.partner_id.purchase_incoterm_id + self.incoterm_address_id = self.partner_id.purchase_incoterm_address_id return res diff --git a/purchase_partner_incoterm/models/res_partner.py b/purchase_partner_incoterm/models/res_partner.py index bbb9af86bcf..8ee4de67630 100644 --- a/purchase_partner_incoterm/models/res_partner.py +++ b/purchase_partner_incoterm/models/res_partner.py @@ -17,9 +17,10 @@ class ResPartner(models.Model): string="Default Purchase Incoterm Address", ) - @api.model - def _commercial_fields(self): - return super()._commercial_fields() + [ - "purchase_incoterm_address_id", - "purchase_incoterm_id", - ] + # TODO this should be enabled throught a config parameter + # @api.model + # def _commercial_fields(self): + # return super()._commercial_fields() + [ + # "purchase_incoterm_address_id", + # "purchase_incoterm_id", + # ]