From 0b4ff36510d280e4eba623a6e02c61b59d6435bc Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Mon, 28 Aug 2023 16:24:18 +0700 Subject: add purchase representative on stock picking per po --- indoteknik_custom/models/stock_picking.py | 11 +++++++++++ indoteknik_custom/views/stock_picking.xml | 6 ++++++ 2 files changed, 17 insertions(+) diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index d35cd9b8..0385566e 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -70,6 +70,17 @@ class StockPicking(models.Model): ('partial', 'Kirim Parsial') ], string='Note', help='jika field ini diisi maka tidak akan dihitung ke lead time') waybill_id = fields.One2many(comodel_name='airway.bill', inverse_name='do_id', string='Airway Bill') + purchase_representative = fields.Char(compute='_compute_purchase_representative') + + def _compute_purchase_representative(self): + for record in self: + po = self.env['purchase.order'].search([ + ('name', '=', record.group_id.name) + ]) + if po: + record.purchase_representative = po[0].user_id.name + else: + record.purchase_representative = False def action_create_invoice_from_mr(self): """Create the invoice associated to the PO. diff --git a/indoteknik_custom/views/stock_picking.xml b/indoteknik_custom/views/stock_picking.xml index 99f0d7c0..4ecd484b 100644 --- a/indoteknik_custom/views/stock_picking.xml +++ b/indoteknik_custom/views/stock_picking.xml @@ -6,6 +6,9 @@ stock.picking + + create_date desc + @@ -13,6 +16,9 @@ + + + -- cgit v1.2.3 From 2676aa95c7c37a8a798675ca58cd2263b2dfcee3 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 29 Aug 2023 09:37:02 +0700 Subject: add purchase representative on stock picking --- indoteknik_custom/models/stock_picking.py | 13 ++----------- indoteknik_custom/views/stock_picking.xml | 3 ++- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index 0385566e..1ffb9aef 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -70,17 +70,8 @@ class StockPicking(models.Model): ('partial', 'Kirim Parsial') ], string='Note', help='jika field ini diisi maka tidak akan dihitung ke lead time') waybill_id = fields.One2many(comodel_name='airway.bill', inverse_name='do_id', string='Airway Bill') - purchase_representative = fields.Char(compute='_compute_purchase_representative') - - def _compute_purchase_representative(self): - for record in self: - po = self.env['purchase.order'].search([ - ('name', '=', record.group_id.name) - ]) - if po: - record.purchase_representative = po[0].user_id.name - else: - record.purchase_representative = False + purchase_representative_id = fields.Many2one('res.users', related='move_lines.purchase_line_id.order_id.user_id', + string="Purchase Representative", readonly=True) def action_create_invoice_from_mr(self): """Create the invoice associated to the PO. diff --git a/indoteknik_custom/views/stock_picking.xml b/indoteknik_custom/views/stock_picking.xml index 4ecd484b..7aa66a6a 100644 --- a/indoteknik_custom/views/stock_picking.xml +++ b/indoteknik_custom/views/stock_picking.xml @@ -17,7 +17,7 @@ - + @@ -57,6 +57,7 @@ + -- cgit v1.2.3 From 664cabd6c3056424a9bb5a7a1c281246f7ed94ff Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 29 Aug 2023 10:21:37 +0700 Subject: financial report --- indoteknik_custom/models/account_financial_report.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/indoteknik_custom/models/account_financial_report.py b/indoteknik_custom/models/account_financial_report.py index 6147a3f3..d8037ee8 100644 --- a/indoteknik_custom/models/account_financial_report.py +++ b/indoteknik_custom/models/account_financial_report.py @@ -70,7 +70,12 @@ class AccountingReport(models.TransientModel): for date_range in date_ranges: row_number = 9 data['form']['used_context']['date_to'] = date_range['date_to'] - data['form']['used_context']['date_from'] = first_journal_date + + if obj.account_report_id.id in [338]: + data['form']['used_context']['date_from'] = first_journal_date + else: + data['form']['used_context']['date_from'] = date_range['date_from'] + comp_dic['state'] = 'posted' comp_dic['journal_ids'] = data['form']['journal_ids'] data['form']['comparison_context'] = comp_dic -- cgit v1.2.3 From 30376ae3d8850423589101170d0ba25b01801ec6 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 29 Aug 2023 10:52:31 +0700 Subject: financial report --- indoteknik_custom/models/account_financial_report.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indoteknik_custom/models/account_financial_report.py b/indoteknik_custom/models/account_financial_report.py index d8037ee8..c2376d6f 100644 --- a/indoteknik_custom/models/account_financial_report.py +++ b/indoteknik_custom/models/account_financial_report.py @@ -72,7 +72,7 @@ class AccountingReport(models.TransientModel): data['form']['used_context']['date_to'] = date_range['date_to'] if obj.account_report_id.id in [338]: - data['form']['used_context']['date_from'] = first_journal_date + data['form']['used_context']['date_from'] = datetime.date(2021, 11, 30) else: data['form']['used_context']['date_from'] = date_range['date_from'] -- cgit v1.2.3 From d8b5c8392596b4090dfe7074dfe807cab066ee03 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 29 Aug 2023 11:00:48 +0700 Subject: validate name product --- indoteknik_custom/models/product_template.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py index 52f72729..0c7ef845 100755 --- a/indoteknik_custom/models/product_template.py +++ b/indoteknik_custom/models/product_template.py @@ -54,11 +54,11 @@ class ProductTemplate(models.Model): @api.constrains('name') def _validate_name(self): - pattern = r'^[a-zA-Z0-9\[\]\(\)\.\s/%]+$' + pattern = r'^[a-zA-Z0-9\[\]\(\)\.\s/%-]+$' if not re.match(pattern, self.name): - pattern_suggest = r'[a-zA-Z0-9\[\]\(\)\.\s/%]+' + pattern_suggest = r'[a-zA-Z0-9\[\]\(\)\.\s/%-]+' suggest = ''.join(re.findall(pattern_suggest, self.name)) - raise UserError(f'Nama hanya bisa menggunakan angka, huruf kecil, huruf besar, titik, kurung lengkung, kurung siku, garis miring. Contoh: {suggest}') + raise UserError(f'Nama hanya bisa menggunakan angka, strip, huruf kecil, huruf besar, titik, kurung lengkung, kurung siku, garis miring. Contoh: {suggest}') # def write(self, vals): # if 'solr_flag' not in vals and self.solr_flag == 1: @@ -290,11 +290,11 @@ class ProductProduct(models.Model): @api.constrains('name') def _validate_name(self): - pattern = r'^[a-zA-Z0-9\[\]\(\)\.\s/%]+$' + pattern = r'^[a-zA-Z0-9\[\]\(\)\.\s/%-]+$' if not re.match(pattern, self.name): - pattern_suggest = r'[a-zA-Z0-9\[\]\(\)\.\s/%]+' + pattern_suggest = r'[a-zA-Z0-9\[\]\(\)\.\s/%-]+' suggest = ''.join(re.findall(pattern_suggest, self.name)) - raise UserError(f'Nama hanya bisa menggunakan angka, huruf kecil, huruf besar, titik, kurung lengkung, kurung siku, garis miring. Contoh: {suggest}') + raise UserError(f'Nama hanya bisa menggunakan angka, strip, huruf kecil, huruf besar, titik, kurung lengkung, kurung siku, garis miring. Contoh: {suggest}') def _get_qty_incoming_bandengan(self): for product in self: -- cgit v1.2.3