diff options
| -rw-r--r-- | indoteknik_custom/models/account_move.py | 11 | ||||
| -rwxr-xr-x | indoteknik_custom/models/sale_order.py | 8 | ||||
| -rw-r--r-- | indoteknik_custom/views/account_move.xml | 3 |
3 files changed, 22 insertions, 0 deletions
diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py index 699191d6..82a86a39 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -31,6 +31,17 @@ class AccountMove(models.Model): due_line = fields.One2many('due.extension.line', 'invoice_id', compute='_compute_due_line', string='Due Extension Lines') no_faktur_pajak = fields.Char(string='No Faktur Pajak') date_completed = fields.Datetime(string='Date Completed') + mark_upload_efaktur = fields.Selection([ + ('belum_upload', 'Belum Upload FP'), + ('sudah_upload', 'Sudah Upload FP'), + ], 'Mark Upload Faktur', compute='_compute_mark_upload_efaktur', default='belum_upload') + + def _compute_mark_upload_efaktur(self): + for move in self: + if move.date_efaktur_exported or move.is_efaktur_exported or move.efaktur_document: + move.mark_upload_efaktur = 'sudah_upload' + else: + move.mark_upload_efaktur = 'belum_upload' def _compute_due_line(self): for invoice in self: diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 55a6bd26..bf10246a 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -84,6 +84,14 @@ class SaleOrder(models.Model): helper_by_id = fields.Many2one('res.users', 'Helper By') # picking_ids = fields.Many2many('stock.picking', string='Pickings', compute='_get_pickings', readonly=True, copy=False, search="_search_picking_ids") + @api.constrains('email') + def _validate_email(self): + rule_regex = self.env['ir.config_parameter'].sudo().get_param('sale.order.validate_email') or '' + pattern = rf'^{rule_regex}$' + + if self.email and not re.match(pattern, self.email): + raise UserError('Email harus menggunakan karakter @') + def override_allow_create_invoice(self): if not self.env.user.is_accounting: raise UserError('Hanya Finance Accounting yang dapat klik tombol ini') diff --git a/indoteknik_custom/views/account_move.xml b/indoteknik_custom/views/account_move.xml index b0a206bf..973bfc01 100644 --- a/indoteknik_custom/views/account_move.xml +++ b/indoteknik_custom/views/account_move.xml @@ -56,6 +56,9 @@ </field> <field name="invoice_date_due" position="after"> <field name="invoice_day_to_due" attrs="{'invisible': [['payment_state', 'in', ('paid', 'in_payment', 'reversed')]]}"/> + <field name="mark_upload_efaktur" widget="badge" + decoration-danger="mark_upload_efaktur == 'belum_upload'" + decoration-success="mark_upload_efaktur == 'sudah_upload'" /> <field name="due_extension" optional="hide"/> </field> <field name="payment_state" position="after"> |
