From 5d0266a4f843a1ba21127a6536a8c37d59c01647 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Thu, 4 May 2023 10:27:02 +0700 Subject: new window brand vendor for procurement --- indoteknik_custom/__manifest__.py | 1 + indoteknik_custom/models/__init__.py | 1 + indoteknik_custom/models/brand_vendor.py | 13 ++++++ indoteknik_custom/models/x_manufactures.py | 9 ++++ indoteknik_custom/security/ir.model.access.csv | 3 +- indoteknik_custom/views/brand_vendor.xml | 60 ++++++++++++++++++++++++++ indoteknik_custom/views/x_manufactures.xml | 1 + 7 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 indoteknik_custom/models/brand_vendor.py create mode 100644 indoteknik_custom/views/brand_vendor.xml diff --git a/indoteknik_custom/__manifest__.py b/indoteknik_custom/__manifest__.py index c6b20e38..d9e98975 100755 --- a/indoteknik_custom/__manifest__.py +++ b/indoteknik_custom/__manifest__.py @@ -73,6 +73,7 @@ 'views/raja_ongkir.xml', 'views/procurement_monitoring_detail.xml', 'views/product_product.xml', + 'views/brand_vendor.xml', 'report/report.xml', 'report/report_banner_banner.xml', 'report/report_banner_banner2.xml', diff --git a/indoteknik_custom/models/__init__.py b/indoteknik_custom/models/__init__.py index 68b7df93..5dc9ce9e 100755 --- a/indoteknik_custom/models/__init__.py +++ b/indoteknik_custom/models/__init__.py @@ -60,3 +60,4 @@ from . import automatic_purchase from . import apache_solr from . import raja_ongkir from . import procurement_monitoring_detail +from . import brand_vendor \ No newline at end of file diff --git a/indoteknik_custom/models/brand_vendor.py b/indoteknik_custom/models/brand_vendor.py new file mode 100644 index 00000000..0fd122ca --- /dev/null +++ b/indoteknik_custom/models/brand_vendor.py @@ -0,0 +1,13 @@ +from odoo import models, fields +import logging + +_logger = logging.getLogger(__name__) + + +class BrandVendor(models.Model): + _name = 'brand.vendor' + _order = 'id asc' + + x_manufacture_id = fields.Many2one('x_manufactures', string='Manufacture') + partner_id = fields.Many2one('res.partner', string='Vendor') + priority = fields.Integer(string='Priority', default=0) diff --git a/indoteknik_custom/models/x_manufactures.py b/indoteknik_custom/models/x_manufactures.py index dd6948a9..710bfe8a 100755 --- a/indoteknik_custom/models/x_manufactures.py +++ b/indoteknik_custom/models/x_manufactures.py @@ -46,6 +46,15 @@ class XManufactures(models.Model): show_as_new_product = fields.Boolean(string='Show as New Product', help='Centang jika ingin ditammpilkan di website sebagai segment Produk Baru') parent_id = fields.Many2one('x_manufactures', string='Parent', help='Parent Brand tersebut') category_ids = fields.Many2many('product.public.category', string='Category', help='Brand tsb memiliki Category apa saja') + vendor_ids = fields.Many2many('res.partner', string='Vendor', compute='_compute_vendor_ids') + + def _compute_vendor_ids(self): + for manufacture in self: + vendor_ids = [] + brand_vendors = self.env['brand.vendor'].search([('x_manufacture_id', '=', manufacture.id)], order='priority') + for vendor in brand_vendors: + vendor_ids.append(vendor.partner_id.id) + manufacture.vendor_ids = vendor_ids def cache_reset(self): manufactures = self.env['x_manufactures'].search([ diff --git a/indoteknik_custom/security/ir.model.access.csv b/indoteknik_custom/security/ir.model.access.csv index 2a5d9879..39504393 100755 --- a/indoteknik_custom/security/ir.model.access.csv +++ b/indoteknik_custom/security/ir.model.access.csv @@ -47,4 +47,5 @@ access_automatic_purchase_match,access.automatic.purchase.match,model_automatic_ 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 access_procurement_monitoring_detail,access.procurement.monitoring.detail,model_procurement_monitoring_detail,,1,1,1,1 -access_rajaongkir_kurir,access.rajaongkir.kurir,model_rajaongkir_kurir,,1,1,1,1 \ No newline at end of file +access_rajaongkir_kurir,access.rajaongkir.kurir,model_rajaongkir_kurir,,1,1,1,1 +access_brand_vendor,access.brand.vendor,model_brand_vendor,,1,1,1,1 \ No newline at end of file diff --git a/indoteknik_custom/views/brand_vendor.xml b/indoteknik_custom/views/brand_vendor.xml new file mode 100644 index 00000000..ee253748 --- /dev/null +++ b/indoteknik_custom/views/brand_vendor.xml @@ -0,0 +1,60 @@ + + + + brand.vendor.tree + brand.vendor + + + + + + + + + + + brand.vendor.form + brand.vendor + +
+ + + + + + + + + +
+
+
+ + + brand.vendor.filter + brand.vendor + + + + + + + + + + + Brand Vendor + ir.actions.act_window + brand.vendor + + tree,form + + + +
\ No newline at end of file diff --git a/indoteknik_custom/views/x_manufactures.xml b/indoteknik_custom/views/x_manufactures.xml index ce00c980..a88c5d34 100755 --- a/indoteknik_custom/views/x_manufactures.xml +++ b/indoteknik_custom/views/x_manufactures.xml @@ -49,6 +49,7 @@ + -- cgit v1.2.3