From 2da83fccfee9a11b7f8b3e5d1fe798e21fa230f5 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Fri, 2 Aug 2024 13:47:16 +0700 Subject: deactivate scheduled action user cart --- indoteknik_custom/views/website_user_cart.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/indoteknik_custom/views/website_user_cart.xml b/indoteknik_custom/views/website_user_cart.xml index 818284e2..11573121 100755 --- a/indoteknik_custom/views/website_user_cart.xml +++ b/indoteknik_custom/views/website_user_cart.xml @@ -62,7 +62,6 @@ model.action_mail_reminder_to_checkout() code 75 - True -- cgit v1.2.3 From 350014811b8776042afc0942223c0281b8ff3976 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Mon, 5 Aug 2024 09:43:36 +0700 Subject: add file_quotation to api --- indoteknik_api/controllers/api_v1/lead.py | 1 + 1 file changed, 1 insertion(+) diff --git a/indoteknik_api/controllers/api_v1/lead.py b/indoteknik_api/controllers/api_v1/lead.py index 23c3bf99..d5cc7c5c 100644 --- a/indoteknik_api/controllers/api_v1/lead.py +++ b/indoteknik_api/controllers/api_v1/lead.py @@ -15,6 +15,7 @@ class Lead(controller.Controller): "file_nib": [], "file_tdp": [], "file_siup": [], + "file_quotation": [], "description": [] }) -- cgit v1.2.3 From 9318594b9f575ebd944056d84c48ce4e5507eece Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 6 Aug 2024 08:56:22 +0700 Subject: cr voucher shipping --- indoteknik_api/controllers/api_v1/voucher.py | 5 +++++ indoteknik_custom/models/voucher.py | 1 + 2 files changed, 6 insertions(+) diff --git a/indoteknik_api/controllers/api_v1/voucher.py b/indoteknik_api/controllers/api_v1/voucher.py index 53f118ec..cd5dff20 100644 --- a/indoteknik_api/controllers/api_v1/voucher.py +++ b/indoteknik_api/controllers/api_v1/voucher.py @@ -20,6 +20,7 @@ class Voucher(controller.Controller): def get_vouchers_by_user_id(self, **kw): cart = request.env['website.user.cart'] code = kw.get('code') + type = kw.get('type') user_id = int(kw.get('user_id', 0)) source = kw.get('source') visibility = ['public'] @@ -32,6 +33,10 @@ class Voucher(controller.Controller): if user_pricelist: domain += [('excl_pricelist_ids', 'not in', [user_pricelist.id])] + if type: + type = type.split(',') + domain += [('apply_type', 'in', type)] + domain += [('visibility', 'in', visibility)] vouchers = request.env['voucher'].get_active_voucher(domain) checkout = cart.get_user_checkout(user_id, source=source) diff --git a/indoteknik_custom/models/voucher.py b/indoteknik_custom/models/voucher.py index 66f763e0..c21ef209 100644 --- a/indoteknik_custom/models/voucher.py +++ b/indoteknik_custom/models/voucher.py @@ -90,6 +90,7 @@ class Voucher(models.Model): 'image': ir_attachment.api_image('voucher', 'image', self.id), 'name': self.name, 'code': self.code, + 'apply_type': self.apply_type, 'description': self.description, 'remaining_time': self._res_remaining_time(), } -- cgit v1.2.3 From 2f2247612b34e0ae6c26285a82f54942c25a3901 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Thu, 8 Aug 2024 14:45:09 +0700 Subject: add ppn to grand total logbook bill --- indoteknik_custom/models/logbook_bill.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/indoteknik_custom/models/logbook_bill.py b/indoteknik_custom/models/logbook_bill.py index 578ad59b..bb956092 100644 --- a/indoteknik_custom/models/logbook_bill.py +++ b/indoteknik_custom/models/logbook_bill.py @@ -22,7 +22,9 @@ class LogbookBill(models.TransientModel): ('product_id', '=', line.product_id.id), ], order='id desc', limit=1) total += line.quantity_done * po.price_unit - return total + total_with_tax = total * 1.11 + return total_with_tax + def create_logbook_bill(self): logbook_line = self.logbook_bill_line -- cgit v1.2.3 From 52463bfd1d11c18c107370735751f940e8ce11d8 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Fri, 9 Aug 2024 17:06:23 +0700 Subject: only finance accounting can change the payment term --- indoteknik_custom/models/res_partner.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/indoteknik_custom/models/res_partner.py b/indoteknik_custom/models/res_partner.py index 19699aab..00ebe674 100644 --- a/indoteknik_custom/models/res_partner.py +++ b/indoteknik_custom/models/res_partner.py @@ -48,6 +48,15 @@ class ResPartner(models.Model): user_payment_terms_purchase = fields.Many2one('res.users', string='Users Update Payment Terms') date_payment_terms_purchase = fields.Datetime(string='Date Update Payment Terms') + def write(self, vals): + res = super(ResPartner, self).write(vals) + + if 'property_payment_term_id' in vals: + if not self.env.user.is_accounting: + raise UserError('Hanya Finance Accounting yang dapat merubah payment term') + + return res + @api.constrains('property_payment_term_id') def updated_by_payment_term(self): for rec in self: -- cgit v1.2.3 From 5be79e919b64ea6d3f92b255a697f8f56c75e764 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Fri, 9 Aug 2024 17:16:13 +0700 Subject: update logic payment term --- indoteknik_custom/models/res_partner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indoteknik_custom/models/res_partner.py b/indoteknik_custom/models/res_partner.py index 00ebe674..77273610 100644 --- a/indoteknik_custom/models/res_partner.py +++ b/indoteknik_custom/models/res_partner.py @@ -52,7 +52,7 @@ class ResPartner(models.Model): res = super(ResPartner, self).write(vals) if 'property_payment_term_id' in vals: - if not self.env.user.is_accounting: + if not self.env.user.is_accounting and vals['property_payment_term_id'] != 26: raise UserError('Hanya Finance Accounting yang dapat merubah payment term') return res -- cgit v1.2.3 From d04f8c0c1496dc12e5b9c629be63ceead1d113a2 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Mon, 12 Aug 2024 10:31:01 +0700 Subject: add 1 hari to day extension de --- indoteknik_custom/models/account_move_due_extension.py | 1 + 1 file changed, 1 insertion(+) diff --git a/indoteknik_custom/models/account_move_due_extension.py b/indoteknik_custom/models/account_move_due_extension.py index c9af7f8d..0399c6a2 100644 --- a/indoteknik_custom/models/account_move_due_extension.py +++ b/indoteknik_custom/models/account_move_due_extension.py @@ -24,6 +24,7 @@ class DueExtension(models.Model): ('approved', 'Approved'), ], string='Approval Status', readonly=True, copy=False, index=True, tracking=3) day_extension = fields.Selection([ + ('1', '1 Hari'), ('3', '3 Hari'), ('7', '7 Hari'), ('14', '14 Hari'), -- cgit v1.2.3 From 926b5bc3dbf88c4c92ed26c73e129a1c3896bde0 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Mon, 12 Aug 2024 10:42:59 +0700 Subject: add npwp and sppkp validation --- indoteknik_custom/models/sale_order.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 44e4a886..14957b24 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -500,6 +500,10 @@ class SaleOrder(models.Model): raise UserError("Credit Limit pada Master Data Customer harus diisi") if order.payment_term_id != partner.property_payment_term_id: raise UserError("Payment Term berbeda pada Master Data Customer") + if (partner.customer_type == 'pkp' or order.customer_type == 'pkp') and order.npwp != partner.npwp: + raise UserError("NPWP berbeda pada Master Data Customer") + if (partner.customer_type == 'pkp' or order.customer_type == 'pkp') and order.sppkp != partner.sppkp: + raise UserError("SPPKP berbeda pada Master Data Customer") if not order.client_order_ref and order.create_date > datetime(2024, 6, 27): raise UserError("Customer Reference kosong, di isi dengan NO PO jika PO tidak ada mohon ditulis Tanpa PO") @@ -517,6 +521,10 @@ class SaleOrder(models.Model): raise UserError("Credit Limit pada Master Data Customer harus diisi") if order.payment_term_id != partner.property_payment_term_id: raise UserError("Payment Term berbeda pada Master Data Customer") + if (partner.customer_type == 'pkp' or order.customer_type == 'pkp') and order.npwp != partner.npwp: + raise UserError("NPWP berbeda pada Master Data Customer") + if (partner.customer_type == 'pkp' or order.customer_type == 'pkp') and order.sppkp != partner.sppkp: + raise UserError("SPPKP berbeda pada Master Data Customer") if not order.client_order_ref and order.create_date > datetime(2024, 6, 27): raise UserError("Customer Reference kosong, di isi dengan NO PO jika PO tidak ada mohon ditulis Tanpa PO") -- cgit v1.2.3 From 13e91e0f7d9132a3d6dfa53f898db2ca08ee089b Mon Sep 17 00:00:00 2001 From: trisusilo48 Date: Mon, 12 Aug 2024 15:42:20 +0700 Subject: add required --- indoteknik_custom/models/res_partner.py | 5 +++++ indoteknik_custom/views/res_partner.xml | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/indoteknik_custom/models/res_partner.py b/indoteknik_custom/models/res_partner.py index 77273610..39faf9d3 100644 --- a/indoteknik_custom/models/res_partner.py +++ b/indoteknik_custom/models/res_partner.py @@ -120,5 +120,10 @@ class ResPartner(models.Model): if self._name == 'res.partner': raise UserError('Maaf anda tidak bisa delete contact') + @api.onchange('customer_type') + def _onchange_customer_type(self): + if self.customer_type == 'nonpkp': + self.npwp = '00.000.000.0-000.000' + diff --git a/indoteknik_custom/views/res_partner.xml b/indoteknik_custom/views/res_partner.xml index b928b046..8bacd2d2 100644 --- a/indoteknik_custom/views/res_partner.xml +++ b/indoteknik_custom/views/res_partner.xml @@ -27,7 +27,7 @@ - + -- cgit v1.2.3 From 64b78ce44b4268abf406f1c6fbf8793a9499890b Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 13 Aug 2024 09:01:54 +0700 Subject: update pj --- indoteknik_custom/models/purchasing_job.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indoteknik_custom/models/purchasing_job.py b/indoteknik_custom/models/purchasing_job.py index 373e469a..da783ab1 100644 --- a/indoteknik_custom/models/purchasing_job.py +++ b/indoteknik_custom/models/purchasing_job.py @@ -96,7 +96,7 @@ class PurchasingJob(models.Model): ) AS sub ON sub.product_id = pmp.product_id LEFT JOIN latest_purchase_orders po ON po.product_id = pmp.product_id LEFT JOIN random_user_ids ru ON ru.vendor_id = sub.vendor_id OR (ru.vendor_id IS NULL AND sub.vendor_id != 9688) - WHERE pmp.action = 'kurang' + WHERE pmp.po_number = 'kosong' and pmp.action = 'kurang' AND sub.vendor_id IS NOT NULL GROUP BY pmp.product_id, -- cgit v1.2.3 From 433939b1a8b9cb6338b01282288704cf6f8430d3 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 13 Aug 2024 09:21:03 +0700 Subject: update purchasing job --- indoteknik_custom/models/automatic_purchase.py | 2 +- indoteknik_custom/models/purchasing_job.py | 33 +++++++++++++++----------- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/indoteknik_custom/models/automatic_purchase.py b/indoteknik_custom/models/automatic_purchase.py index 73416c48..35dffc48 100644 --- a/indoteknik_custom/models/automatic_purchase.py +++ b/indoteknik_custom/models/automatic_purchase.py @@ -396,7 +396,7 @@ class AutomaticPurchase(models.Model): domain = [ ('product_id', '=', line.product_id.id) ] - sale = self.env['v.sales.outstanding'].search(domain, limit=1) + sale = self.env['v.sales.outstanding'].search(domain, order='create_date desc', limit=1) existing_match = self.env['automatic.purchase.sales.match'].search([ ('automatic_purchase_id', '=', self.id), diff --git a/indoteknik_custom/models/purchasing_job.py b/indoteknik_custom/models/purchasing_job.py index da783ab1..810a9e65 100644 --- a/indoteknik_custom/models/purchasing_job.py +++ b/indoteknik_custom/models/purchasing_job.py @@ -183,6 +183,7 @@ class OutstandingSales(models.Model): outgoing = fields.Float(string='Outgoing') brand = fields.Char(string='Brand') invoice_partner = fields.Char(string='Invoice Partner') + sale_order_create_date = fields.Datetime(string='Sale Order Create Date') def init(self): tools.drop_view_if_exists(self.env.cr, self._table) @@ -199,19 +200,23 @@ class OutstandingSales(models.Model): 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 - join sale_order_line sol on sol.id = sm.sale_line_id - join sale_order so on so.id = sol.order_id - join res_partner rp on rp.id = so.partner_invoice_id - join res_users ru on ru.id = so.user_id - join res_partner rp2 on rp2.id = ru.partner_id - join product_product pp on pp.id = sm.product_id - join product_template pt on pt.id = pp.product_tmpl_id - left join x_manufactures xm on xm.id = pt.x_manufacture - where sp.state in ('draft', 'waiting', 'confirmed', 'assigned') - and sp.name like '%OUT%' + 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, + so.create_date as sale_order_create_date + from stock_move sm + join stock_picking sp on sp.id = sm.picking_id + join sale_order_line sol on sol.id = sm.sale_line_id + join sale_order so on so.id = sol.order_id + join res_partner rp on rp.id = so.partner_invoice_id + join res_users ru on ru.id = so.user_id + join res_partner rp2 on rp2.id = ru.partner_id + join product_product pp on pp.id = sm.product_id + join product_template pt on pt.id = pp.product_tmpl_id + left join x_manufactures xm on xm.id = pt.x_manufacture + where sp.state in ('draft', 'waiting', 'confirmed', 'assigned') + and sp.name like '%OUT%' ) """) -- cgit v1.2.3 From 1fb90f4b0ea75ca0b9eb723924a2ba4ea27a5a65 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 13 Aug 2024 13:20:53 +0700 Subject: update pj --- indoteknik_custom/models/automatic_purchase.py | 2 +- indoteknik_custom/models/purchasing_job.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/indoteknik_custom/models/automatic_purchase.py b/indoteknik_custom/models/automatic_purchase.py index 35dffc48..f5b1baf9 100644 --- a/indoteknik_custom/models/automatic_purchase.py +++ b/indoteknik_custom/models/automatic_purchase.py @@ -396,7 +396,7 @@ class AutomaticPurchase(models.Model): domain = [ ('product_id', '=', line.product_id.id) ] - sale = self.env['v.sales.outstanding'].search(domain, order='create_date desc', limit=1) + sale = self.env['v.sales.outstanding'].search(domain, order='sale_order_create_date desc', limit=1) existing_match = self.env['automatic.purchase.sales.match'].search([ ('automatic_purchase_id', '=', self.id), diff --git a/indoteknik_custom/models/purchasing_job.py b/indoteknik_custom/models/purchasing_job.py index 810a9e65..6e4f239d 100644 --- a/indoteknik_custom/models/purchasing_job.py +++ b/indoteknik_custom/models/purchasing_job.py @@ -96,7 +96,7 @@ class PurchasingJob(models.Model): ) AS sub ON sub.product_id = pmp.product_id LEFT JOIN latest_purchase_orders po ON po.product_id = pmp.product_id LEFT JOIN random_user_ids ru ON ru.vendor_id = sub.vendor_id OR (ru.vendor_id IS NULL AND sub.vendor_id != 9688) - WHERE pmp.po_number = 'kosong' and pmp.action = 'kurang' + WHERE pmp.action = 'kurang' AND sub.vendor_id IS NOT NULL GROUP BY pmp.product_id, -- cgit v1.2.3 From 7772fcd29c37b03ba0b23c233aa8e030a82a0d81 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 13 Aug 2024 14:08:29 +0700 Subject: approval date doc --- indoteknik_custom/__manifest__.py | 1 + indoteknik_custom/models/__init__.py | 1 + indoteknik_custom/models/approval_date_doc.py | 49 +++++++++++++++++++++ indoteknik_custom/security/ir.model.access.csv | 1 + indoteknik_custom/views/approval_date_doc.xml | 61 ++++++++++++++++++++++++++ indoteknik_custom/views/ir_sequence.xml | 10 +++++ 6 files changed, 123 insertions(+) create mode 100644 indoteknik_custom/models/approval_date_doc.py create mode 100644 indoteknik_custom/views/approval_date_doc.xml diff --git a/indoteknik_custom/__manifest__.py b/indoteknik_custom/__manifest__.py index 32678ef5..b3c3bc5d 100755 --- a/indoteknik_custom/__manifest__.py +++ b/indoteknik_custom/__manifest__.py @@ -139,6 +139,7 @@ 'views/report_logbook_bill.xml', 'views/sale_order_multi_uangmuka_penjualan.xml', 'views/shipment_group.xml', + 'views/approval_date_doc.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 116354d6..e9ce587c 100755 --- a/indoteknik_custom/models/__init__.py +++ b/indoteknik_custom/models/__init__.py @@ -124,3 +124,4 @@ from . import report_logbook_bill from . import sale_order_multi_uangmuka_penjualan from . import shipment_group from . import sales_order_reject +from . import approval_date_doc diff --git a/indoteknik_custom/models/approval_date_doc.py b/indoteknik_custom/models/approval_date_doc.py new file mode 100644 index 00000000..e00b7416 --- /dev/null +++ b/indoteknik_custom/models/approval_date_doc.py @@ -0,0 +1,49 @@ +from odoo import models, api, fields +from odoo.exceptions import AccessError, UserError, ValidationError +from datetime import timedelta, date, datetime +import logging + +_logger = logging.getLogger(__name__) + +class ApprovalDateDoc(models.Model): + _name = "approval.date.doc" + _description = "Approval Date Doc" + _rec_name = 'number' + + picking_id = fields.Many2one('stock.picking', string='Picking') + number = fields.Char(string='Document No', index=True, copy=False, readonly=True, tracking=True) + driver_departure_date = fields.Datetime( + string='Driver Departure Date', + copy=False + ) + state = fields.Selection([('draft', 'Draft'), ('done', 'Done')], string='State', default='draft', tracking=True) + approve_date = fields.Datetime(string='Approve Date', copy=False) + approve_by = fields.Many2one('res.users', string='Approve By', copy=False) + sale_id = fields.Many2one('sale.order', string='Sale Order') + + @api.onchange('picking_id') + def onchange_picking_id(self): + if self.picking_id: + self.sale_id = self.picking_id.sale_id.id + + def check_invoice_so_picking(self): + for rec in self: + invoice = self.env['account.move'].search_count([('sale_id', '=', rec.picking_id.sale_id.id)]) + + if invoice < 1: + raise UserError("Sales Order Belum Memiliki Invoice, Anda Bisa Edit Di DO nya langsung") + + def button_approve(self): + if not self.env.user.is_accounting: + raise UserError("Hanya Accounting Yang Bisa Approve") + self.check_invoice_so_picking + self.picking_id.driver_departure_date = self.driver_departure_date + self.state = 'done' + self.approve_date = datetime.utcnow() + self.approve_by = self.env.user.id + + @api.model + def create(self, vals): + vals['number'] = self.env['ir.sequence'].next_by_code('approval.date.doc') or '0' + result = super(ApprovalDateDoc, self).create(vals) + return result diff --git a/indoteknik_custom/security/ir.model.access.csv b/indoteknik_custom/security/ir.model.access.csv index 95ad57f0..5e7554a5 100755 --- a/indoteknik_custom/security/ir.model.access.csv +++ b/indoteknik_custom/security/ir.model.access.csv @@ -133,3 +133,4 @@ access_sale_order_multi_uangmuka_penjualan,access.sale.order.multi_uangmuka_penj access_shipment_group,access.shipment.group,model_shipment_group,,1,1,1,1 access_shipment_group_line,access.shipment.group.line,model_shipment_group_line,,1,1,1,1 access_sales_order_reject,access.sales.order.reject,model_sales_order_reject,,1,1,1,1 +access_approval_date_doc,access.approval.date.doc,model_approval_date_doc,,1,1,1,1 diff --git a/indoteknik_custom/views/approval_date_doc.xml b/indoteknik_custom/views/approval_date_doc.xml new file mode 100644 index 00000000..d6a70763 --- /dev/null +++ b/indoteknik_custom/views/approval_date_doc.xml @@ -0,0 +1,61 @@ + + + + approval.date.doc.tree + approval.date.doc + + + + + + + + + + + + + + + approval.date.doc.form + approval.date.doc + +
+
+
+ + + + + + + + + + + + + +
+
+
+ + + Approval Date Doc + ir.actions.act_window + approval.date.doc + tree,form + + + + +
\ No newline at end of file diff --git a/indoteknik_custom/views/ir_sequence.xml b/indoteknik_custom/views/ir_sequence.xml index b4fb5c0c..b2768c71 100644 --- a/indoteknik_custom/views/ir_sequence.xml +++ b/indoteknik_custom/views/ir_sequence.xml @@ -11,6 +11,16 @@ 1
+ + Approval Date Doc + approval.date.doc + TRUE + ADD/%(year)s/ + 5 + 1 + 1 + + Logbook SJ report.logbook.sj -- cgit v1.2.3 From 8eaffe2f3590e52b90835fada67460e119032dee Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 13 Aug 2024 14:08:54 +0700 Subject: approval date doc --- indoteknik_custom/models/stock_picking.py | 11 ++++++++++- indoteknik_custom/views/stock_picking.xml | 5 +++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index c151a543..47ac3166 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -26,7 +26,6 @@ class StockPicking(models.Model): # Delivery Order driver_departure_date = fields.Datetime( string='Driver Departure Date', - readonly=True, copy=False ) driver_arrival_date = fields.Datetime( @@ -91,6 +90,16 @@ class StockPicking(models.Model): date_availability = fields.Datetime(string="Date Availability", copy=False, tracking=True) sale_order = fields.Char(string='Matches SO', copy=False) printed_sj = fields.Boolean('Printed Surat Jalan', help='flag which is internal use or not') + invoice_status = fields.Selection([ + ('upselling', 'Upselling Opportunity'), + ('invoiced', 'Fully Invoiced'), + ('to invoice', 'To Invoice'), + ('no', 'Nothing to Invoice') + ], string='Invoice Status', related="sale_id.invoice_status") + + @api.constrains('driver_departure_date') + def constrains_driver_departure_date(self): + self.date_doc_kirim = self.driver_departure_date def reset_status_printed(self): for rec in self: diff --git a/indoteknik_custom/views/stock_picking.xml b/indoteknik_custom/views/stock_picking.xml index 7567dda2..a58f3003 100644 --- a/indoteknik_custom/views/stock_picking.xml +++ b/indoteknik_custom/views/stock_picking.xml @@ -71,7 +71,8 @@ - + + - + -- cgit v1.2.3 From 844cfbdf7a961dddb8c6c0b63f1dcaf72bc84f51 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Wed, 14 Aug 2024 09:44:48 +0700 Subject: arrival_time do --- indoteknik_custom/models/stock_picking.py | 15 ++++++++++++++- indoteknik_custom/views/res_partner.xml | 9 +++++++++ indoteknik_custom/views/stock_picking.xml | 3 +++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index 47ac3166..9fb4ae82 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -28,6 +28,10 @@ class StockPicking(models.Model): string='Driver Departure Date', copy=False ) + arrival_time = fields.Datetime( + string='Jam Kedatangan', + copy=False + ) driver_arrival_date = fields.Datetime( string='Driver Arrival Date', readonly=True, @@ -98,9 +102,14 @@ class StockPicking(models.Model): ], string='Invoice Status', related="sale_id.invoice_status") @api.constrains('driver_departure_date') - def constrains_driver_departure_date(self): + def constrains_driver_departure_date(self): self.date_doc_kirim = self.driver_departure_date + @api.constrains('arrival_time') + def constrains_arrival_time(self): + if self.arrival_time > datetime.datetime.utcnow(): + raise UserError('Jam kedatangan harus kurang dari Effective Date') + def reset_status_printed(self): for rec in self: rec.status_printed = 'not_printed' @@ -350,6 +359,9 @@ class StockPicking(models.Model): if not self.picking_code: self.picking_code = self.env['ir.sequence'].next_by_code('stock.picking.code') or '0' + if not self.arrival_time: + raise UserError('Jam Kedatangan harus diisi') + if self.picking_type_id.code == 'incoming' and self.group_id.id == False and self.is_internal_use == False: raise UserError(_('Tidak bisa Validate jika tidak dari Document SO / PO')) @@ -381,6 +393,7 @@ class StockPicking(models.Model): res = super(StockPicking, self).button_validate() self.calculate_line_no() + self.date_done = datetime.datetime.utcnow() return res @api.model diff --git a/indoteknik_custom/views/res_partner.xml b/indoteknik_custom/views/res_partner.xml index 8bacd2d2..bfac1eb3 100644 --- a/indoteknik_custom/views/res_partner.xml +++ b/indoteknik_custom/views/res_partner.xml @@ -26,6 +26,15 @@ + + 1 + + + 1 + + + 1 + diff --git a/indoteknik_custom/views/stock_picking.xml b/indoteknik_custom/views/stock_picking.xml index a58f3003..899d29eb 100644 --- a/indoteknik_custom/views/stock_picking.xml +++ b/indoteknik_custom/views/stock_picking.xml @@ -68,6 +68,9 @@ + + + -- cgit v1.2.3 From c091a99de4e3c3bb4f85a8b0c91d75735ebefbd4 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Wed, 14 Aug 2024 09:57:25 +0700 Subject: cr arrival time --- indoteknik_custom/models/stock_picking.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index 9fb4ae82..5029a770 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -359,7 +359,7 @@ class StockPicking(models.Model): if not self.picking_code: self.picking_code = self.env['ir.sequence'].next_by_code('stock.picking.code') or '0' - if not self.arrival_time: + if not self.arrival_time and 'BU/IN/' in self.name: raise UserError('Jam Kedatangan harus diisi') if self.picking_type_id.code == 'incoming' and self.group_id.id == False and self.is_internal_use == False: -- cgit v1.2.3