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/__manifest__.py | 1 + indoteknik_custom/models/automatic_purchase.py | 2 +- indoteknik_custom/models/res_partner.py | 6 +++ indoteknik_custom/security/ir.model.access.csv | 3 +- indoteknik_custom/views/group_partner.xml | 55 ++++++++++++++++++++++++++ 5 files changed, 65 insertions(+), 2 deletions(-) create mode 100644 indoteknik_custom/views/group_partner.xml diff --git a/indoteknik_custom/__manifest__.py b/indoteknik_custom/__manifest__.py index 5873d73a..6e67afe1 100755 --- a/indoteknik_custom/__manifest__.py +++ b/indoteknik_custom/__manifest__.py @@ -11,6 +11,7 @@ 'depends': ['base', 'coupon', 'delivery', 'sale', 'sale_management', 'vit_kelurahan'], 'data': [ 'security/ir.model.access.csv', + 'views/group_partner.xml', 'views/blog_post.xml', 'views/coupon_program.xml', 'views/delivery_order.xml', 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') + diff --git a/indoteknik_custom/security/ir.model.access.csv b/indoteknik_custom/security/ir.model.access.csv index 1788c77f..f7de6d3f 100755 --- a/indoteknik_custom/security/ir.model.access.csv +++ b/indoteknik_custom/security/ir.model.access.csv @@ -44,4 +44,5 @@ access_uangmuka_pembelian,access.uangmuka.pembelian,model_uangmuka_pembelian,,1, access_automatic_purchase,access.automatic.purchase,model_automatic_purchase,,1,1,1,1 access_automatic_purchase_line,access.automatic.purchase.line,model_automatic_purchase_line,,1,1,1,1 access_automatic_purchase_match,access.automatic.purchase.match,model_automatic_purchase_match,,1,1,1,1 -access_apache_solr,access.apache.solr,model_apache_solr,,1,1,1,1 \ No newline at end of file +access_apache_solr,access.apache.solr,model_apache_solr,,1,1,1,1 +access_group_partner,access.group.partner,model_group_partner,,1,1,1,1 \ No newline at end of file diff --git a/indoteknik_custom/views/group_partner.xml b/indoteknik_custom/views/group_partner.xml new file mode 100644 index 00000000..4d5fd923 --- /dev/null +++ b/indoteknik_custom/views/group_partner.xml @@ -0,0 +1,55 @@ + + + + group.partner.tree + group.partner + + + + + + + + + group.partner.form + group.partner + +
+ + + + + + + +
+
+
+ + + group.partner.list.select + group.partner + + + + + + + + + + Group Partner + ir.actions.act_window + group.partner + + tree,form + + + +
\ No newline at end of file -- cgit v1.2.3