diff options
| -rw-r--r-- | indoteknik_custom/models/account_move.py | 18 | ||||
| -rwxr-xr-x | indoteknik_custom/models/sale_order.py | 6 | ||||
| -rwxr-xr-x | indoteknik_custom/views/sale_order.xml | 6 |
3 files changed, 18 insertions, 12 deletions
diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py index 4e1beb3a..fe9db583 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -151,10 +151,16 @@ class AccountMove(models.Model): } return action - def write(self, vals): - res = super(AccountMove, self).write(vals) + @api.constrains('efaktur_id', 'ref', 'date', 'journal_id', 'name') + def constrains_edit(self): for rec in self.line_ids: - if rec.write_date != rec.create_date: - if rec.statement_line_id and not rec.statement_line_id.statement_id.is_edit and rec.statement_line_id.statement_id.state == 'confirm': - raise UserError('Bank Statement di Lock, Minta admin reconcile untuk unlock') - return res + if rec.statement_line_id and not rec.statement_line_id.statement_id.is_edit and rec.statement_line_id.statement_id.state == 'confirm': + raise UserError('Bank Statement di Lock, Minta admin reconcile untuk unlock') + + # def write(self, vals): + # res = super(AccountMove, self).write(vals) + # for rec in self.line_ids: + # if rec.write_date != rec.create_date: + # if rec.statement_line_id and not rec.statement_line_id.statement_id.is_edit and rec.statement_line_id.statement_id.state == 'confirm': + # raise UserError('Bank Statement di Lock, Minta admin reconcile untuk unlock') + # return res diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index dbc4e863..f9229bca 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -70,9 +70,9 @@ class SaleOrder(models.Model): customer_type = fields.Selection([ ('pkp', 'PKP'), ('nonpkp', 'Non PKP') - ]) - sppkp = fields.Char(string="SPPKP") - npwp = fields.Char(string="NPWP") + ], required=True) + sppkp = fields.Char(string="SPPKP", required=True) + npwp = fields.Char(string="NPWP", required=True) purchase_total = fields.Monetary(string='Purchase Total', compute='_compute_purchase_total') voucher_id = fields.Many2one(comodel_name='voucher', string='Voucher', copy=False) applied_voucher_id = fields.Many2one(comodel_name='voucher', string='Applied Voucher', copy=False) diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml index c6187f60..5596c271 100755 --- a/indoteknik_custom/views/sale_order.xml +++ b/indoteknik_custom/views/sale_order.xml @@ -45,9 +45,9 @@ <field name="helper_by_id" readonly="1"/> </field> <field name="analytic_account_id" position="after"> - <field name="customer_type" attrs="{'required': ['|', ('create_date', '>', '2023-06-28'), ('create_date', '=', False)]}"/> - <field name="npwp" placeholder='99.999.999.9-999.999' attrs="{'required': ['|', ('create_date', '>', '2023-06-28'), ('create_date', '=', False)]}"/> - <field name="sppkp" attrs="{'invisible': [('customer_type','!=','pkp')], 'required': [('customer_type', '=', 'pkp')]}"/> + <field name="customer_type" required="1"/> + <field name="npwp" placeholder='99.999.999.9-999.999' required="1"/> + <field name="sppkp" required="1"/> <field name="email" required="1"/> <field name="due_id" readonly="1"/> <field name="source_id" domain="[('id', 'in', [32, 59, 60, 61])]" required="1"/> |
