diff options
| -rwxr-xr-x | indoteknik_custom/__manifest__.py | 1 | ||||
| -rwxr-xr-x | indoteknik_custom/models/__init__.py | 3 | ||||
| -rw-r--r-- | indoteknik_custom/models/automatic_purchase.py | 10 | ||||
| -rw-r--r-- | indoteknik_custom/models/stock_warehouse_orderpoint.py | 10 | ||||
| -rwxr-xr-x | indoteknik_custom/models/x_manufactures.py | 2 | ||||
| -rw-r--r-- | indoteknik_custom/views/automatic_purchase.xml | 2 | ||||
| -rw-r--r-- | indoteknik_custom/views/stock_warehouse_orderpoint.xml | 15 | ||||
| -rwxr-xr-x | indoteknik_custom/views/x_manufactures.xml | 2 |
8 files changed, 42 insertions, 3 deletions
diff --git a/indoteknik_custom/__manifest__.py b/indoteknik_custom/__manifest__.py index 23abc084..3bc4be60 100755 --- a/indoteknik_custom/__manifest__.py +++ b/indoteknik_custom/__manifest__.py @@ -99,6 +99,7 @@ 'views/quotation_so_multi_update.xml', 'views/stock_move_line.xml', 'views/product_monitoring.xml', + 'views/stock_warehouse_orderpoint.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 1133c3e7..6a5eac00 100755 --- a/indoteknik_custom/models/__init__.py +++ b/indoteknik_custom/models/__init__.py @@ -89,4 +89,5 @@ from . import stock_scheduler_compute from . import promotion from . import sale_orders_multi_update from . import quotation_so_multi_update -from . import product_monitoring
\ No newline at end of file +from . import product_monitoring +from . import stock_warehouse_orderpoint diff --git a/indoteknik_custom/models/automatic_purchase.py b/indoteknik_custom/models/automatic_purchase.py index 990d3cc5..f81ecdcc 100644 --- a/indoteknik_custom/models/automatic_purchase.py +++ b/indoteknik_custom/models/automatic_purchase.py @@ -17,6 +17,7 @@ class AutomaticPurchase(models.Model): is_po = fields.Boolean(string='Is PO') purchase_match = fields.One2many('automatic.purchase.match', 'automatic_purchase_id', string='Matches', auto_join=True) vendor_id = fields.Many2one('res.partner', string='Vendor', help='boleh kosong, jika diisi, maka hanya keluar data untuk vendor tersebut') + responsible_id = fields.Many2one('res.users', string='Responsible', required=True) def create_po_from_automatic_purchase(self): if not self.purchase_lines: @@ -87,7 +88,8 @@ class AutomaticPurchase(models.Model): raise UserError('Sudah digenerate sebelumnya, hapus line terlebih dahulu') query = [ - ('product_min_qty', '>', 0) + ('product_min_qty', '>', 0), + ('product_id.x_manufacture.user_id.id', '=', self.responsible_id.id) ] orderpoints = self.env['stock.warehouse.orderpoint'].search(query) count = 0 @@ -101,10 +103,14 @@ class AutomaticPurchase(models.Model): if self.vendor_id: purchase_price = self.env['purchase.pricelist'].search([ ('product_id', '=', point.product_id.id), + # ('product_id.x_manufacture.user_id.id', '=', self.responsible_id.id), ('vendor_id', '=', self.vendor_id.id) ], order='product_price asc', limit=1) else: - purchase_price = self.env['purchase.pricelist'].search([('product_id', '=', point.product_id.id)], order='product_price asc', limit=1) + purchase_price = self.env['purchase.pricelist'].search([ + ('product_id', '=', point.product_id.id), + # ('product_id.x_manufacture.user_id.id', '=', self.responsible_id.id), + ], order='product_price asc', limit=1) vendor_id = purchase_price.vendor_id.id price = purchase_price.product_price or 0 diff --git a/indoteknik_custom/models/stock_warehouse_orderpoint.py b/indoteknik_custom/models/stock_warehouse_orderpoint.py new file mode 100644 index 00000000..277c8dc3 --- /dev/null +++ b/indoteknik_custom/models/stock_warehouse_orderpoint.py @@ -0,0 +1,10 @@ +from odoo import fields, models, api, _ + +class StockWarehouseOrderpoint(models.Model): + _inherit = 'stock.warehouse.orderpoint' + + responsible_id = fields.Many2one('res.users', string='Responsible', compute='_compute_responsible') + + def _compute_responsible(self): + for stock in self: + stock.responsible_id = stock.product_id.x_manufacture.user_id diff --git a/indoteknik_custom/models/x_manufactures.py b/indoteknik_custom/models/x_manufactures.py index e48a5367..abedf0cf 100755 --- a/indoteknik_custom/models/x_manufactures.py +++ b/indoteknik_custom/models/x_manufactures.py @@ -47,6 +47,8 @@ class XManufactures(models.Model): 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') + # user_id = fields.Many2one('res.users', string='Responsible', domain="['|'('id', '=', 19), ('id', '=', 6)]", help="Siapa yang bertanggung jawab") + user_id = fields.Many2one('res.users', string='Responsible', help="Siapa yang bertanggung jawab") def _compute_vendor_ids(self): for manufacture in self: diff --git a/indoteknik_custom/views/automatic_purchase.xml b/indoteknik_custom/views/automatic_purchase.xml index 49751f4e..0478304e 100644 --- a/indoteknik_custom/views/automatic_purchase.xml +++ b/indoteknik_custom/views/automatic_purchase.xml @@ -10,6 +10,7 @@ <field name="description"/> <field name="notification" readonly="1"/> <field name="is_po" readonly="1"/> + <field name="responsible_id"/> </tree> </field> </record> @@ -57,6 +58,7 @@ <group> <field name="date_doc"/> <field name="vendor_id"/> + <field name="responsible_id"/> <field name="description"/> <field name="notification" readonly="1"/> </group> diff --git a/indoteknik_custom/views/stock_warehouse_orderpoint.xml b/indoteknik_custom/views/stock_warehouse_orderpoint.xml new file mode 100644 index 00000000..038b09cc --- /dev/null +++ b/indoteknik_custom/views/stock_warehouse_orderpoint.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<odoo> + <data> + <record id="stock_warehouse_orderpoint_inherit" model="ir.ui.view"> + <field name="name">stock.warehouse.orderpoint.tree</field> + <field name="model">stock.warehouse.orderpoint</field> + <field name="inherit_id" ref="stock.view_warehouse_orderpoint_tree_editable_config"/> + <field name="arch" type="xml"> + <field name="product_uom_name" position="after"> + <field name="responsible_id" optional="hide"/> + </field> + </field> + </record> + </data> +</odoo>
\ No newline at end of file diff --git a/indoteknik_custom/views/x_manufactures.xml b/indoteknik_custom/views/x_manufactures.xml index f68a0e00..d413be12 100755 --- a/indoteknik_custom/views/x_manufactures.xml +++ b/indoteknik_custom/views/x_manufactures.xml @@ -24,6 +24,7 @@ <field name="x_manufacture_service_center"/> <field name="cache_reset_status"/> <field name="parent_id"/> + <field name="user_id" optional="hide"/> </tree> </field> </record> @@ -46,6 +47,7 @@ <field name="cache_reset_status"/> <field name="parent_id"/> <field name="category_ids" widget="many2many_tags"/> + <field name="user_id"/> </group> <group> <field name="x_logo_manufacture" widget="image"/> |
