From 6fc4731e24f1e6f105676273695262f5da059faf Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Mon, 10 Apr 2023 15:17:38 +0700 Subject: add group partner and fix automatic purchase --- indoteknik_custom/models/automatic_purchase.py | 2 +- indoteknik_custom/models/res_partner.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/automatic_purchase.py b/indoteknik_custom/models/automatic_purchase.py index 60444b6a..f2e7d9e9 100644 --- a/indoteknik_custom/models/automatic_purchase.py +++ b/indoteknik_custom/models/automatic_purchase.py @@ -45,7 +45,7 @@ class AutomaticPurchase(models.Model): ], order='brand_id') count = brand_id = 0 for product in products_vendors: - if vendor.id == 5571 and (count == 200 or brand_id != product.brand_id.id): + if vendor['partner_id'][0] == 5571 and (count == 200 or brand_id != product.brand_id.id): count = 0 counter_po_number += 1 new_po = self.env['purchase.order'].create([param_header]) diff --git a/indoteknik_custom/models/res_partner.py b/indoteknik_custom/models/res_partner.py index ad88957f..eaf93717 100644 --- a/indoteknik_custom/models/res_partner.py +++ b/indoteknik_custom/models/res_partner.py @@ -1,5 +1,9 @@ from odoo import models, fields +class GroupPartner(models.Model): + _name = 'group.partner' + + name = fields.Char(string='Name') class ResPartner(models.Model): _inherit = 'res.partner' @@ -7,3 +11,5 @@ class ResPartner(models.Model): reference_number = fields.Char(string="Reference Number") company_type_id = fields.Many2one('res.partner.company_type', string='Company Type') custom_pricelist_id = fields.Many2one('product.pricelist', string='Price Matrix') + group_partner_id = fields.Many2one('group.partner', string='Group Partner') + -- cgit v1.2.3