From db4547a746308fe1498e36208c1821168183a7e2 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 17 Oct 2023 09:48:32 +0700 Subject: add column note and description in purchase order --- indoteknik_custom/models/purchase_order.py | 1 + 1 file changed, 1 insertion(+) (limited to 'indoteknik_custom/models/purchase_order.py') diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index 8ad25228..5e4617d4 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -47,6 +47,7 @@ class PurchaseOrder(models.Model): count_line_product = fields.Float('Total Item', compute='compute_count_line_product') note_description = fields.Char(string='Note', help='bisa diisi sebagai informasi indent barang tertentu atau apapun') has_active_invoice = fields.Boolean(string='Has Active Invoice', compute='_compute_has_active_invoice') + description = fields.Char(string='Description', help='bisa diisi sebagai informasi indent barang tertentu atau apapun') def _compute_has_active_invoice(self): for order in self: -- cgit v1.2.3 From 0fe05527d92a45b38a3670241636b422c1054320 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Wed, 18 Oct 2023 16:36:25 +0700 Subject: add tax if exclude tax in purchase pricelist --- indoteknik_custom/models/purchase_order.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'indoteknik_custom/models/purchase_order.py') diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index 5e4617d4..59d5ac3e 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -56,6 +56,14 @@ class PurchaseOrder(models.Model): def add_product_to_pricelist(self): for line in self.order_line: current_time = datetime.utcnow() + price_unit = line.price_unit + taxes = line.taxes_id + for tax in taxes: + tax_include = tax.price_include + tax_amt = tax.amount + if taxes: + if not tax_include: + price_unit = price_unit + (price_unit * tax_amt / 100) purchase_pricelist = self.env['purchase.pricelist'].search([ ('product_id', '=', line.product_id.id), -- cgit v1.2.3 From 78f8aeafd40befa56c96f2892012a4a822684265 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Wed, 18 Oct 2023 16:37:11 +0700 Subject: forgot to change field price unit --- indoteknik_custom/models/purchase_order.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indoteknik_custom/models/purchase_order.py') diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index 59d5ac3e..e8cd86fa 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -75,7 +75,7 @@ class PurchaseOrder(models.Model): 'vendor_id': line.order_id.partner_id.id, 'product_id': line.product_id.id, 'product_price': 0.00, - 'system_price': line.price_unit, + 'system_price': price_unit, 'system_last_update': current_time, }]) return True @@ -83,7 +83,7 @@ class PurchaseOrder(models.Model): for pricelist in purchase_pricelist: pricelist.write({ 'system_last_update': current_time, - 'system_price': line.price_unit + 'system_price': price_unit }) def _compute_date_planned(self): -- cgit v1.2.3 From 7e734333e198e8405ce49ef96f5cb347b0a892d4 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Mon, 23 Oct 2023 11:23:27 +0700 Subject: fix re calculate po --- indoteknik_custom/models/purchase_order.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'indoteknik_custom/models/purchase_order.py') diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index e8cd86fa..d62d7b1e 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -338,12 +338,11 @@ class PurchaseOrder(models.Model): def re_calculate(self): for line in self.order_line: sale_order_line = self.env['sale.order.line'].search([ - ('id', '=', line.so_line_id.id), + ('product_id', 'in', [line.product_id.id]), ('order_id', '=', line.order_id.sale_order_id.id) - ], limit=1, order='price_reduce_taxexcl') + ]) for so_line in sale_order_line: - unit_price = line.price_unit - so_line.purchase_price = unit_price + so_line.purchase_price = line.price_unit def button_cancel(self): res = super(PurchaseOrder, self).button_cancel() -- cgit v1.2.3 From 0037ab8019daad5c1cfccd0007284c54b5c22253 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Thu, 26 Oct 2023 11:56:16 +0700 Subject: add indent tab in purchase order --- indoteknik_custom/models/purchase_order.py | 1 + 1 file changed, 1 insertion(+) (limited to 'indoteknik_custom/models/purchase_order.py') diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index d62d7b1e..f9cd7f5b 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -48,6 +48,7 @@ class PurchaseOrder(models.Model): note_description = fields.Char(string='Note', help='bisa diisi sebagai informasi indent barang tertentu atau apapun') has_active_invoice = fields.Boolean(string='Has Active Invoice', compute='_compute_has_active_invoice') description = fields.Char(string='Description', help='bisa diisi sebagai informasi indent barang tertentu atau apapun') + purchase_order_lines = fields.One2many('purchase.order.line', 'order_id', string='Indent', auto_join=True) def _compute_has_active_invoice(self): for order in self: -- cgit v1.2.3 From db561aabfa404edfff9462c812d15a200223b978 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Wed, 8 Nov 2023 11:19:54 +0700 Subject: add responsible in po base on manufacture responsible --- indoteknik_custom/models/purchase_order.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'indoteknik_custom/models/purchase_order.py') diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index f9cd7f5b..b0f1a569 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -49,6 +49,15 @@ class PurchaseOrder(models.Model): has_active_invoice = fields.Boolean(string='Has Active Invoice', compute='_compute_has_active_invoice') description = fields.Char(string='Description', help='bisa diisi sebagai informasi indent barang tertentu atau apapun') purchase_order_lines = fields.One2many('purchase.order.line', 'order_id', string='Indent', auto_join=True) + responsible_ids = fields.Many2many('res.users', string='Responsibles', compute='_compute_responsibles') + + def _compute_responsibles(self): + for purchase in self: + resposible_ids = [] + for line in purchase.order_line: + resposible_ids.append(line.product_id.x_manufacture.user_id.id) + resposible_ids = list(set(resposible_ids)) + purchase.responsible_ids = resposible_ids def _compute_has_active_invoice(self): for order in self: -- cgit v1.2.3