summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2023-12-15 08:34:03 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2023-12-15 08:34:03 +0700
commit1829416edc7b2a8f6ab82cc8a0f7cdd0d07f2fbe (patch)
treebdcf014fa1b8070f9d4f31b38b938d2d1c94eeaa
parent035dfcb4aa9d2a0a18906f62c57e8571b9e8ddd8 (diff)
mark upload efaktur & validate email sale order
-rw-r--r--indoteknik_custom/models/account_move.py11
-rwxr-xr-xindoteknik_custom/models/sale_order.py8
-rw-r--r--indoteknik_custom/views/account_move.xml3
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">