diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2023-05-04 12:20:26 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2023-05-04 12:20:26 +0700 |
| commit | 5636ea3098a830a1c9fca3d18e68de573b22b986 (patch) | |
| tree | f78422516acc2d144da760bf74cf32d453b4b98b | |
| parent | 39883f829f246f06d981e61431d12c3ef812e202 (diff) | |
| parent | 5d0266a4f843a1ba21127a6536a8c37d59c01647 (diff) | |
Merge branch 'brand-vendor' into release
| -rwxr-xr-x | indoteknik_custom/__manifest__.py | 1 | ||||
| -rwxr-xr-x | indoteknik_custom/models/__init__.py | 1 | ||||
| -rw-r--r-- | indoteknik_custom/models/brand_vendor.py | 13 | ||||
| -rwxr-xr-x | indoteknik_custom/models/x_manufactures.py | 9 | ||||
| -rwxr-xr-x | indoteknik_custom/security/ir.model.access.csv | 3 | ||||
| -rw-r--r-- | indoteknik_custom/views/brand_vendor.xml | 60 | ||||
| -rwxr-xr-x | indoteknik_custom/views/x_manufactures.xml | 1 |
7 files changed, 87 insertions, 1 deletions
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 @@ +<?xml version="1.0" encoding="utf-8" ?> +<odoo> + <record id="brand_vendor_tree" model="ir.ui.view"> + <field name="name">brand.vendor.tree</field> + <field name="model">brand.vendor</field> + <field name="arch" type="xml"> + <tree> + <field name="x_manufacture_id"/> + <field name="partner_id"/> + <field name="priority"/> + </tree> + </field> + </record> + + <record id="brand_vendor_form" model="ir.ui.view"> + <field name="name">brand.vendor.form</field> + <field name="model">brand.vendor</field> + <field name="arch" type="xml"> + <form> + <sheet> + <group> + <group> + <field name="x_manufacture_id"/> + <field name="partner_id"/> + <field name="priority"/> + </group> + </group> + </sheet> + </form> + </field> + </record> + + <record id="brand_vendor_filter" model="ir.ui.view"> + <field name="name">brand.vendor.filter</field> + <field name="model">brand.vendor</field> + <field name="priority" eval="15"/> + <field name="arch" type="xml"> + <search string="Search Channel"> + <field name="x_manufacture_id"/> + <field name="partner_id"/> + </search> + </field> + </record> + + <record id="brand_vendor_action" model="ir.actions.act_window"> + <field name="name">Brand Vendor</field> + <field name="type">ir.actions.act_window</field> + <field name="res_model">brand.vendor</field> + <field name="search_view_id" ref="brand_vendor_filter"/> + <field name="view_mode">tree,form</field> + </record> + + <menuitem + id="menu_brand_vendor" + name="Brand Vendor" + parent="purchase.menu_purchase_products" + sequence="6" + action="brand_vendor_action" + /> +</odoo>
\ 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 @@ <field name="x_logo_manufacture" widget="image"/> <field name="image_promotion_1" widget="image" width="80" /> <field name="image_promotion_2" widget="image" width="80" /> + <field name="vendor_ids" widget="many2many_tags"/> </group> </group> <notebook> |
