From 27380e8bbb8be5d0a81a4c5e0410686ce1ae5997 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Wed, 22 May 2024 10:14:55 +0700 Subject: fix error param and add some validation for date kirim --- indoteknik_custom/models/ged.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/ged.py b/indoteknik_custom/models/ged.py index a2e8bc3c..d1f70f1d 100644 --- a/indoteknik_custom/models/ged.py +++ b/indoteknik_custom/models/ged.py @@ -235,6 +235,10 @@ class GedApi(models.Model): status_detail = line['status_detail'] status = line['status'] + if status == 'Received At Warehouse' and not dunning_run.date_kirim_tukar_faktur: + dunning_run.date_kirim_tukar_faktur = line.created_at + dunning_run.copy_date_faktur() + param_line = { 'ged_tracking_id': ged_tracking_id, 'user_input': user_input, @@ -257,20 +261,21 @@ class DunningRunGed(models.Model): ged_tracking = fields.One2many('ged.tracking', 'dunning_id', string='GED Tracking', auto_join=True) ged_tracking_line = fields.One2many('ged.tracking.line', 'dunning_id', string='GED Tracking Line', auto_join=True) - def _get_tracking_history(self, test_awb_number): - if test_awb_number > 0: + def _get_tracking_history(self, awb_number='all_data'): + if awb_number == 'all_data': query = [ ('last_status_awb', '!=', 'POD Return'), - ('resi_tukar_faktur', '=', test_awb_number), - ('shipper_faktur_id', '=', 123) + ('resi_tukar_faktur', '!=', False), + ('shipper_faktur_id', '=', 123), + ('date_terima_tukar_faktur', '=', False) ] else: query = [ ('last_status_awb', '!=', 'POD Return'), - ('resi_tukar_faktur', '!=', False), - ('shipper_faktur_id', '=', 123), - ('date_terima_tukar_faktur', '=', False) + ('resi_tukar_faktur', '=', awb_number), + ('shipper_faktur_id', '=', 123) ] + dunnings = self.env['dunning.run'].search(query, limit=50) for dunning in dunnings: -- cgit v1.2.3 From 30fabf53eedc6fa07a55d2a90ce8e6d4887cbf1e Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Wed, 22 May 2024 14:09:35 +0700 Subject: add description parent name in uang muka --- indoteknik_custom/models/uangmuka_pembelian.py | 5 ++++- indoteknik_custom/models/uangmuka_penjualan.py | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/uangmuka_pembelian.py b/indoteknik_custom/models/uangmuka_pembelian.py index 26a003fd..e3ce4a20 100644 --- a/indoteknik_custom/models/uangmuka_pembelian.py +++ b/indoteknik_custom/models/uangmuka_pembelian.py @@ -41,7 +41,10 @@ class UangmukaPembelian(models.TransientModel): is_have_selisih = True for order in orders: - ref_label = 'UANG MUKA PEMBELIAN '+order.name+' '+order.partner_id.name + partner_name = order.partner_id.name + if order.partner_id.parent_id: + partner_name = order.partner_id.parent_id.name + ref_label = 'UANG MUKA PEMBELIAN '+order.name+' '+partner_name param_header = { 'ref': ref_label, 'date': current_time, diff --git a/indoteknik_custom/models/uangmuka_penjualan.py b/indoteknik_custom/models/uangmuka_penjualan.py index 65f5361b..5acf604d 100644 --- a/indoteknik_custom/models/uangmuka_penjualan.py +++ b/indoteknik_custom/models/uangmuka_penjualan.py @@ -44,7 +44,10 @@ class UangmukaPenjualan(models.TransientModel): current_time = datetime.now() for order in orders: - ref_label = 'UANG MUKA PENJUALAN '+order.name+' '+order.partner_id.name + partner_name = order.partner_id.name + if order.partner_id.parent_id: + partner_name = order.partner_id.parent_id.name + ref_label = 'UANG MUKA PENJUALAN '+order.name+' '+partner_name param_header = { 'ref': ref_label, 'date': current_time, -- cgit v1.2.3 From d0bcbd1b93719b2145a5cdc131f6fa6c9272a4e6 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Wed, 22 May 2024 14:48:58 +0700 Subject: count line on report logbook sj --- indoteknik_custom/models/report_logbook_sj.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/report_logbook_sj.py b/indoteknik_custom/models/report_logbook_sj.py index 093848b5..a1b6299c 100644 --- a/indoteknik_custom/models/report_logbook_sj.py +++ b/indoteknik_custom/models/report_logbook_sj.py @@ -30,6 +30,13 @@ class ReportLogbookSJ(models.Model): tracking=True, ) + count_line = fields.Char(string='Count Line', compute='_compute_count_line') + + @api.depends('report_logbook_sj_line') + def _compute_count_line(self): + for rec in self: + rec.count_line = len(rec.report_logbook_sj_line) + @api.model def create(self, vals): vals['name'] = self.env['ir.sequence'].next_by_code('report.logbook.sj') or '0' -- cgit v1.2.3 From ae2dcf170e30653418a2026f215768015b19eb21 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Sat, 25 May 2024 11:59:33 +0700 Subject: fix bug purchasing job --- indoteknik_custom/models/purchasing_job_multi_update.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/purchasing_job_multi_update.py b/indoteknik_custom/models/purchasing_job_multi_update.py index 0145b112..deba960a 100644 --- a/indoteknik_custom/models/purchasing_job_multi_update.py +++ b/indoteknik_custom/models/purchasing_job_multi_update.py @@ -15,15 +15,15 @@ class PurchasingJobMultiUpdate(models.TransientModel): # if product.status_apo == 'apo': # raise UserError('Ada Purchase Order yang statusnya APO, proses dulu') purchasing_job_state = self.env['purchasing.job.state'].search([ - ('purchasing_job_id', '=', product.id), - ('status_apo', '=', 'apo') + ('purchasing_job_id', '=', product.id) ]) - if not purchasing_job_state: - purchasing_job_state.create({ - 'purchasing_job_id': product.id, - 'status_apo': 'apo', - }) + purchasing_job_state.unlink() + + purchasing_job_state.create({ + 'purchasing_job_id': product.id, + 'status_apo': 'apo', + }) apo = self.env['automatic.purchase'].generate_regular_purchase(products) return { -- cgit v1.2.3 From 72ade0474bcec396affd564ecf83e403d4ba5b82 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Mon, 27 May 2024 11:54:52 +0700 Subject: fix if midtrans expire --- indoteknik_custom/models/sale_order.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index d246f37f..8e772f7e 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -242,6 +242,12 @@ class SaleOrder(models.Model): 'Authorization': midtrans_auth, } + check_url = f'https://api.midtrans.com/v2/{so_number}/expire' + check_response = requests.get(check_url, headers=headers) + + if check_response.status_code == 407: + so_number = so_number + '-cpl' + json_data = { 'transaction_details': { 'order_id': so_number, -- cgit v1.2.3 From 803eb3054d801c276e250d98b901da70d9e25632 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Mon, 27 May 2024 13:31:45 +0700 Subject: trying to fix api midtrans expire status --- indoteknik_custom/models/sale_order.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 8e772f7e..dd6753aa 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -242,11 +242,13 @@ class SaleOrder(models.Model): 'Authorization': midtrans_auth, } - check_url = f'https://api.midtrans.com/v2/{so_number}/expire' + check_url = f'https://api.midtrans.com/v2/{so_number}/status' check_response = requests.get(check_url, headers=headers) - if check_response.status_code == 407: - so_number = so_number + '-cpl' + if check_response.status_code == 200: + status_response = check_response.json() + if status_response.get('transaction_status') == 'expire': + so_number = so_number + '-cpl' json_data = { 'transaction_details': { -- cgit v1.2.3 From 779d8e483c660c63afed91f849cce251d7acdab5 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Mon, 27 May 2024 14:47:36 +0700 Subject: add tracking update payment terms on res partner --- indoteknik_custom/models/res_partner.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/res_partner.py b/indoteknik_custom/models/res_partner.py index eee19b2f..ea06854d 100644 --- a/indoteknik_custom/models/res_partner.py +++ b/indoteknik_custom/models/res_partner.py @@ -1,5 +1,6 @@ from odoo import models, fields, api from odoo.exceptions import UserError, ValidationError +from datetime import datetime class GroupPartner(models.Model): _name = 'group.partner' @@ -39,7 +40,24 @@ class ResPartner(models.Model): ('PNR', 'Pareto Non Repeating'), ('NP', 'Non Pareto') ]) + + user_payment_terms_sales = fields.Many2one('res.users', string='Users Update Payment Terms') + date_payment_terms_sales = fields.Datetime(string='Date Update Payment Terms') + user_payment_terms_purchase = fields.Many2one('res.users', string='Users Update Payment Terms') + date_payment_terms_purchase = fields.Datetime(string='Date Update Payment Terms') + + @api.constrains('property_payment_term_id') + def updated_by_payment_term(self): + for rec in self: + rec.user_payment_terms_sales = self.env.user.id + rec.date_payment_terms_sales = datetime.utcnow() + @api.constrains('property_supplier_payment_term_id') + def updated_by_payment_term(self): + for rec in self: + rec.user_payment_terms_purchase = self.env.user.id + rec.date_payment_terms_purchase = datetime.utcnow() + @api.onchange('site_id') def _onchange_site_id(self): for rec in self: -- cgit v1.2.3 From ea1c7c6f8e52f256e585c80d17a1b3af2a5ca863 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 28 May 2024 13:19:18 +0700 Subject: add note on matches_so apo --- indoteknik_custom/models/automatic_purchase.py | 11 +++++++++++ indoteknik_custom/models/sale_order_line.py | 12 ++++++++++++ 2 files changed, 23 insertions(+) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/automatic_purchase.py b/indoteknik_custom/models/automatic_purchase.py index af09abf0..e169af83 100644 --- a/indoteknik_custom/models/automatic_purchase.py +++ b/indoteknik_custom/models/automatic_purchase.py @@ -570,6 +570,17 @@ class AutomaticPurchaseSalesMatch(models.Model): qty_po = fields.Float(string='Qty PO') purchase_price = fields.Float(string='Purchase Price SO') purchase_tax_id = fields.Many2one('account.tax', string='Tax', domain=['|', ('active', '=', False), ('active', '=', True)]) + note_procurement = fields.Char(string='Note Detail', help="Harap diisi jika ada keterangan tambahan dari Procurement, agar dapat dimonitoring") + + @api.constrains('note_procurement') + def note_procurement_to_so_line(self): + for rec in self: + so_line = self.env['sale.order.line'].search([ + ('id', '=', rec.sale_line_id.id), + ], limit=1) + + if so_line.note_procurement != rec.note_procurement: + so_line.note_procurement = rec.note_procurement class SyncPurchasingJob(models.Model): _name = 'sync.purchasing.job' diff --git a/indoteknik_custom/models/sale_order_line.py b/indoteknik_custom/models/sale_order_line.py index 8fb34328..11346fc9 100644 --- a/indoteknik_custom/models/sale_order_line.py +++ b/indoteknik_custom/models/sale_order_line.py @@ -31,6 +31,18 @@ class SaleOrderLine(models.Model): qty_reserved = fields.Float(string='Qty Reserved', compute='_compute_qty_reserved') reserved_from = fields.Char(string='Reserved From', copy=False) + @api.constrains('note_procurement') + def note_procurement_to_apo(self): + for line in self: + matches_so = self.env['automatic.purchase.sales.match'].search([ + ('sale_line_id', '=', line.id), + ]) + + for match_so in matches_so: + match_so.note_procurement = line.note_procurement + + + @api.onchange('product_uom', 'product_uom_qty') def product_uom_change(self): if not self.product_uom or not self.product_id: -- cgit v1.2.3 From 048895dc4e01a16ad381f5a14201333cba2f3de2 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 28 May 2024 13:56:16 +0700 Subject: change request note procurement apo --- indoteknik_custom/models/automatic_purchase.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/automatic_purchase.py b/indoteknik_custom/models/automatic_purchase.py index e169af83..21d21c9c 100644 --- a/indoteknik_custom/models/automatic_purchase.py +++ b/indoteknik_custom/models/automatic_purchase.py @@ -578,6 +578,9 @@ class AutomaticPurchaseSalesMatch(models.Model): so_line = self.env['sale.order.line'].search([ ('id', '=', rec.sale_line_id.id), ], limit=1) + + if so_line.note_procurement == False: + so_line.note_procurement = rec.note_procurement if so_line.note_procurement != rec.note_procurement: so_line.note_procurement = rec.note_procurement -- cgit v1.2.3 From cfdc348fec88a695a7d0df148ec5a3f83e8831d1 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Wed, 29 May 2024 13:23:58 +0700 Subject: add last human update to program monitoring --- indoteknik_custom/models/promotion/promotion_monitoring.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/promotion/promotion_monitoring.py b/indoteknik_custom/models/promotion/promotion_monitoring.py index 9df0825d..8a8aad8f 100644 --- a/indoteknik_custom/models/promotion/promotion_monitoring.py +++ b/indoteknik_custom/models/promotion/promotion_monitoring.py @@ -12,6 +12,7 @@ class PromotionMonitoring(models.Model): has_promo = fields.Boolean(string="Has Promo") count_active = fields.Integer(string="Count Active") count_inactive = fields.Integer(string="Count Inactive") + human_last_update = fields.Datetime(string='Human Last Update') def init(self): tools.drop_view_if_exists(self.env.cr, self._table) @@ -27,16 +28,18 @@ class PromotionMonitoring(models.Model): ppi.computed_price as price, ({count_active} > 0) as has_promo, {count_active} as count_active, - {count_inactive} as count_inactive + {count_inactive} as count_inactive, + pr.human_last_update as human_last_update FROM product_product p LEFT JOIN product_template pt ON pt.id = p.product_tmpl_id LEFT JOIN promotion_product pp ON pp.product_id = p.id LEFT JOIN promotion_program_line ppl ON ppl.id = pp.program_line_id LEFT JOIN product_pricelist_item ppi ON ppi.product_id = p.id + LEFT JOIN purchase_pricelist pr ON pr.product_id = p.id WHERE p.active = True AND pt.sale_ok = True AND ppi.pricelist_id = 17023 - GROUP BY p.id, ppi.id + GROUP BY p.id, ppi.id, pr.human_last_update ) """.format( table=self._table, -- cgit v1.2.3 From 50eacdb74fa081d5be2a0cea787843b8c123ec17 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Wed, 29 May 2024 16:43:59 +0700 Subject: add promotion program lines name on promotion monitoring --- indoteknik_custom/models/promotion/promotion_monitoring.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/promotion/promotion_monitoring.py b/indoteknik_custom/models/promotion/promotion_monitoring.py index 8a8aad8f..2c4b90f1 100644 --- a/indoteknik_custom/models/promotion/promotion_monitoring.py +++ b/indoteknik_custom/models/promotion/promotion_monitoring.py @@ -13,6 +13,7 @@ class PromotionMonitoring(models.Model): count_active = fields.Integer(string="Count Active") count_inactive = fields.Integer(string="Count Inactive") human_last_update = fields.Datetime(string='Human Last Update') + promotion_program_line_names = fields.Text(string="Promotion Program Line Names") def init(self): tools.drop_view_if_exists(self.env.cr, self._table) @@ -26,21 +27,23 @@ class PromotionMonitoring(models.Model): p.id as id, p.id as product_id, ppi.computed_price as price, - ({count_active} > 0) as has_promo, - {count_active} as count_active, - {count_inactive} as count_inactive, - pr.human_last_update as human_last_update + (COUNT(ppl.id) FILTER (WHERE ppl.active = True) > 0) as has_promo, + COUNT(ppl.id) FILTER (WHERE ppl.active = True) as count_active, + COUNT(ppl.id) FILTER (WHERE ppl.active = False) as count_inactive, + pr.human_last_update as human_last_update, + STRING_AGG(DISTINCT ppl.name, ', ') as promotion_program_line_names -- Concatenate promotion_program_line names FROM product_product p LEFT JOIN product_template pt ON pt.id = p.product_tmpl_id LEFT JOIN promotion_product pp ON pp.product_id = p.id LEFT JOIN promotion_program_line ppl ON ppl.id = pp.program_line_id LEFT JOIN product_pricelist_item ppi ON ppi.product_id = p.id LEFT JOIN purchase_pricelist pr ON pr.product_id = p.id + LEFT JOIN promotion_product prp ON prp.product_id = p.id -- Join with promotion.product WHERE p.active = True AND pt.sale_ok = True AND ppi.pricelist_id = 17023 GROUP BY p.id, ppi.id, pr.human_last_update - ) + ); """.format( table=self._table, count_active=sql['count_active'], -- cgit v1.2.3 From c0bc0039928cdb7e2eef8e39dc5daad6e5ecfc28 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Thu, 30 May 2024 08:54:30 +0700 Subject: increase limit of tracking ged --- indoteknik_custom/models/ged.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/ged.py b/indoteknik_custom/models/ged.py index d1f70f1d..2abfb425 100644 --- a/indoteknik_custom/models/ged.py +++ b/indoteknik_custom/models/ged.py @@ -276,7 +276,7 @@ class DunningRunGed(models.Model): ('shipper_faktur_id', '=', 123) ] - dunnings = self.env['dunning.run'].search(query, limit=50) + dunnings = self.env['dunning.run'].search(query, limit=100) for dunning in dunnings: current_tracking = self.env['ged.tracking'].search([('awb_no', '=', dunning.resi_tukar_faktur)], limit=1) -- cgit v1.2.3 From 65fe5e9cb0865293eb6d0626d2c99f35d6862b3c Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Thu, 30 May 2024 16:09:35 +0700 Subject: add invoice_date_due and terima faktur on bills --- indoteknik_custom/models/__init__.py | 1 + indoteknik_custom/models/account_move.py | 9 +++++++- .../models/account_move_multi_update_bills.py | 26 ++++++++++++++++++++++ indoteknik_custom/models/purchasing_job.py | 15 ++++++++++--- indoteknik_custom/models/sale_order.py | 2 +- 5 files changed, 48 insertions(+), 5 deletions(-) create mode 100644 indoteknik_custom/models/account_move_multi_update_bills.py (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/__init__.py b/indoteknik_custom/models/__init__.py index 33aa0784..cd1e4d29 100755 --- a/indoteknik_custom/models/__init__.py +++ b/indoteknik_custom/models/__init__.py @@ -113,3 +113,4 @@ from . import sales_order_fullfillment from . import res_partner_site from . import external_api from . import ged +from . import account_move_multi_update_bills diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py index b306b6af..aa8b97be 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -246,7 +246,7 @@ class AccountMove(models.Model): due_date = tukar_date + timedelta(days=add_days) invoice.invoice_date_due = due_date - @api.onchange('date_terima_tukar_faktur') + @api.constrains('date_terima_tukar_faktur') def change_date_terima_tukar_faktur(self): for invoice in self: if not invoice.date_terima_tukar_faktur: @@ -266,6 +266,13 @@ class AccountMove(models.Model): } return action + def open_form_multi_update_bills(self): + action = self.env['ir.actions.act_window']._for_xml_id('indoteknik_custom.action_account_move_multi_update_bills') + action['context'] = { + 'move_ids': [x.id for x in self] + } + return action + @api.constrains('efaktur_id', 'ref', 'date', 'journal_id', 'name') def constrains_edit(self): for rec in self.line_ids: diff --git a/indoteknik_custom/models/account_move_multi_update_bills.py b/indoteknik_custom/models/account_move_multi_update_bills.py new file mode 100644 index 00000000..d348beed --- /dev/null +++ b/indoteknik_custom/models/account_move_multi_update_bills.py @@ -0,0 +1,26 @@ +from odoo import models, fields +import logging + +_logger = logging.getLogger(__name__) + + +class AccountMoveMultiUpdateBills(models.TransientModel): + _name = 'account.move.multi_update_bills' + + date_terima_tukar_faktur = fields.Date(string="Terima Faktur") + + def save_multi_update_bills(self): + move_ids = self._context['move_ids'] + moves = self.env['account.move'].browse(move_ids) + moves.update({ + 'date_terima_tukar_faktur': self.date_terima_tukar_faktur + }) + return { + 'type': 'ir.actions.client', + 'tag': 'display_notification', + 'params': { + 'title': 'Notification', + 'message': 'Account Move berhasil diubah', + 'next': {'type': 'ir.actions.act_window_close'}, + } + } \ No newline at end of file diff --git a/indoteknik_custom/models/purchasing_job.py b/indoteknik_custom/models/purchasing_job.py index 86f8afcc..373e469a 100644 --- a/indoteknik_custom/models/purchasing_job.py +++ b/indoteknik_custom/models/purchasing_job.py @@ -188,9 +188,18 @@ class OutstandingSales(models.Model): tools.drop_view_if_exists(self.env.cr, self._table) self.env.cr.execute(""" CREATE OR REPLACE VIEW v_sales_outstanding AS ( - select sm.id, sm.id as move_id, sp.id as picking_id, sm.product_id, so.id as sale_id, - sol.id as sale_line_id, rp.id as partner_id, so.user_id as salesperson_id, so.partner_invoice_id, - sp.origin, rp2.name as salesperson, coalesce(pp.default_code, pt.default_code) as item_code, pt.name as product, + select sm.id, + sm.id as move_id, + sp.id as picking_id, + sm.product_id, + so.id as sale_id, + sol.id as sale_line_id, + rp.id as partner_id, + so.user_id as salesperson_id, + so.partner_invoice_id, + sp.origin, + rp2.name as salesperson, + coalesce(pp.default_code, pt.default_code) as item_code, pt.name as product, sm.product_uom_qty as outgoing, xm.x_name as brand, rp.name as invoice_partner from stock_move sm join stock_picking sp on sp.id = sm.picking_id diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index dd6753aa..9a4f9035 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -423,7 +423,7 @@ class SaleOrder(models.Model): if self.payment_term_id.id == 31 and self.total_percent_margin < 25: raise UserError("Jika ingin menggunakan Tempo 90 Hari maka margin harus di atas 25%") - if self.warehouse_id.id != 8: #GD Bandengan + if self.warehouse_id.id != 8 and self.warehouse_id.id != 10: #GD Bandengan raise UserError('Gudang harus Bandengan') if self.state not in ['draft', 'sent']: -- cgit v1.2.3 From fa490e19dcad3f841f00c67dfbd880ffd327254c Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Fri, 31 May 2024 15:41:36 +0700 Subject: add log to dunning run --- indoteknik_custom/models/dunning_run.py | 1 + 1 file changed, 1 insertion(+) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/dunning_run.py b/indoteknik_custom/models/dunning_run.py index 4e04c03c..d75d7c51 100644 --- a/indoteknik_custom/models/dunning_run.py +++ b/indoteknik_custom/models/dunning_run.py @@ -11,6 +11,7 @@ class DunningRun(models.Model): _name = 'dunning.run' _description = 'Dunning Run' _order = 'dunning_date desc, id desc' + _inherit = ['mail.thread'] _rec_name = 'number' number = fields.Char(string='Document No', index=True, copy=False, readonly=True) -- cgit v1.2.3 From f01969680c174f21be8fb9fde2032c749a62cf62 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Mon, 3 Jun 2024 15:56:00 +0700 Subject: def cargo --- indoteknik_custom/models/__init__.py | 2 ++ indoteknik_custom/models/def_cargo/__init__.py | 3 +++ indoteknik_custom/models/def_cargo/def_cargo_city.py | 11 +++++++++++ indoteknik_custom/models/def_cargo/def_cargo_district.py | 15 +++++++++++++++ indoteknik_custom/models/def_cargo/def_cargo_province.py | 10 ++++++++++ 5 files changed, 41 insertions(+) create mode 100644 indoteknik_custom/models/def_cargo/__init__.py create mode 100644 indoteknik_custom/models/def_cargo/def_cargo_city.py create mode 100644 indoteknik_custom/models/def_cargo/def_cargo_district.py create mode 100644 indoteknik_custom/models/def_cargo/def_cargo_province.py (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/__init__.py b/indoteknik_custom/models/__init__.py index cd1e4d29..510dd659 100755 --- a/indoteknik_custom/models/__init__.py +++ b/indoteknik_custom/models/__init__.py @@ -106,6 +106,7 @@ from . import po_multi_cancel from . import logbook_sj from . import report_logbook_sj from . import role_permission + from . import cust_commision from . import report_stock_forecasted from . import web_logging @@ -114,3 +115,4 @@ from . import res_partner_site from . import external_api from . import ged from . import account_move_multi_update_bills +from . import def_cargo diff --git a/indoteknik_custom/models/def_cargo/__init__.py b/indoteknik_custom/models/def_cargo/__init__.py new file mode 100644 index 00000000..d6f2b19e --- /dev/null +++ b/indoteknik_custom/models/def_cargo/__init__.py @@ -0,0 +1,3 @@ +from . import def_cargo_province +from . import def_cargo_city +from . import def_cargo_district \ No newline at end of file diff --git a/indoteknik_custom/models/def_cargo/def_cargo_city.py b/indoteknik_custom/models/def_cargo/def_cargo_city.py new file mode 100644 index 00000000..4e7015be --- /dev/null +++ b/indoteknik_custom/models/def_cargo/def_cargo_city.py @@ -0,0 +1,11 @@ +from odoo import fields, models, api +from datetime import datetime, timedelta +import logging + +_logger = logging.getLogger(__name__) + + +class DefCargoCity(models.Model): + _name = 'def.cargo.city' + name = fields.Char(string="Name") + province_id = fields.Many2one('def.cargo.province', string="Province") diff --git a/indoteknik_custom/models/def_cargo/def_cargo_district.py b/indoteknik_custom/models/def_cargo/def_cargo_district.py new file mode 100644 index 00000000..0650005d --- /dev/null +++ b/indoteknik_custom/models/def_cargo/def_cargo_district.py @@ -0,0 +1,15 @@ +from odoo import fields, models, api +from datetime import datetime, timedelta +import logging + +_logger = logging.getLogger(__name__) + + +class DefCargoDistrict(models.Model): + _name = 'def.cargo.district' + name = fields.Char(string="Name") + city_id = fields.Many2one('def.cargo.city', string="City") + coverage = fields.Char(string="Coverage") + rate = fields.Float(string="Rate (min 10kg)") + next_kg = fields.Float(string="Next Kg") + sla = fields.Char(string="SLA") diff --git a/indoteknik_custom/models/def_cargo/def_cargo_province.py b/indoteknik_custom/models/def_cargo/def_cargo_province.py new file mode 100644 index 00000000..c666da5a --- /dev/null +++ b/indoteknik_custom/models/def_cargo/def_cargo_province.py @@ -0,0 +1,10 @@ +from odoo import fields, models, api +from datetime import datetime, timedelta +import logging + +_logger = logging.getLogger(__name__) + + +class DefCargoProvince(models.Model): + _name = 'def.cargo.province' + name = fields.Char(string="Name") -- cgit v1.2.3 From a43bd9bf10855e4340bb0711d423dd517ee688b1 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 4 Jun 2024 10:25:06 +0700 Subject: add logging status --- indoteknik_custom/models/ged.py | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/ged.py b/indoteknik_custom/models/ged.py index 2abfb425..ef7b422a 100644 --- a/indoteknik_custom/models/ged.py +++ b/indoteknik_custom/models/ged.py @@ -124,6 +124,27 @@ class GedApi(models.Model): self.env['token.storage'].create([param]) return token + def get_tracking_awb_log(self, dunning_run): + token = self._get_token() + headers = { + 'Content-Type': 'application/json', + 'Accept': 'application/json', + 'X-Ged-Key': x_ged_key, + 'X-Ged-Password': x_ged_password, + 'Authorization': 'Bearer ' + token + } + json_data = { + 'data': { + 'awb': dunning_run.resi_tukar_faktur + } + } + response = requests.post(url_tracking, headers=headers, json=json_data) + log = { + 'body': str(json_data), + 'responses': str(response.json()) + } + self.env['ged.tracking.log'].create(log) + def get_tracking_awb(self, dunning_run): # current_time = datetime.now() # current_time = current_time.strftime('%Y-%m-%d %H:%M:%S') @@ -292,5 +313,22 @@ class DunningRunGed(models.Model): dunning.copy_date_faktur() return + def _get_tracking_history_log(self, awb_number='all_data'): + query = [ + ('last_status_awb', '!=', 'POD Return'), + ('resi_tukar_faktur', '=', awb_number), + ('shipper_faktur_id', '=', 123) + ] + + dunnings = self.env['dunning.run'].search(query, limit=1) + + for dunning in dunnings: + ged_api = self.env['ged.api'] + ged_api.get_tracking_awb_log(dunning) + return + def get_tracking_history_by_awb(self): - self._get_tracking_history(self.resi_tukar_faktur) \ No newline at end of file + self._get_tracking_history(self.resi_tukar_faktur) + + def get_tracking_history_by_awb_log(self): + self._get_tracking_history_log(self.resi_tukar_faktur) -- cgit v1.2.3 From 9306992db370c793e8cab494038b0de5b61b600f Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 4 Jun 2024 15:39:31 +0700 Subject: add sni and tkdn on product_template --- indoteknik_custom/models/product_template.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py index 97ad07a7..6086a2ca 100755 --- a/indoteknik_custom/models/product_template.py +++ b/indoteknik_custom/models/product_template.py @@ -57,6 +57,8 @@ class ProductTemplate(models.Model): ('sp', 'Spare Part'), ('acc', 'Accessories') ], string='Kind of', copy=False) + sni = fields.Boolean(string='SNI') + tkdn = fields.Boolean(string='TKDN') def _get_qty_sold(self): for rec in self: -- cgit v1.2.3