diff options
| author | Indoteknik . <andrifebriyadiputra@gmail.com> | 2025-05-05 11:05:13 +0700 |
|---|---|---|
| committer | Indoteknik . <andrifebriyadiputra@gmail.com> | 2025-05-05 11:05:13 +0700 |
| commit | b00d3caf6cd21ae74872031536ceb2f1ff570316 (patch) | |
| tree | 81df0d888d98a6c64b6f173a56e26c161594df8c | |
| parent | ca48d2fcffbb48d6b3a09360144a71101f6f41ef (diff) | |
(andri) NPWP di SO menjadi readonly
| -rwxr-xr-x | indoteknik_custom/models/sale_order.py | 8 | ||||
| -rwxr-xr-x | indoteknik_custom/views/sale_order.xml | 2 |
2 files changed, 8 insertions, 2 deletions
diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 4c48684d..baa72dc0 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -204,7 +204,7 @@ class SaleOrder(models.Model): ('nonpkp', 'Non PKP') ], required=True) sppkp = fields.Char(string="SPPKP", required=True, tracking=True) - npwp = fields.Char(string="NPWP", required=True, tracking=True) + npwp = fields.Char(string="NPWP", required=True, tracking=True, compute='_compute_npwp') 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) @@ -995,6 +995,12 @@ class SaleOrder(models.Model): # return ['&', ('order_line.invoice_lines.move_id.move_type', 'in', ('out_invoice', 'out_refund')), ('order_line.invoice_lines.move_id', operator, value)] + @api.depends('partner_id') + def _compute_npwp(self): + for order in self: + partner = order.partner_id.parent_id or order.partner_id + order.npwp = partner.npwp + @api.onchange('partner_id') def onchange_partner_contact(self): parent_id = self.partner_id.parent_id diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml index 10c60e24..376ccb20 100755 --- a/indoteknik_custom/views/sale_order.xml +++ b/indoteknik_custom/views/sale_order.xml @@ -99,7 +99,7 @@ </field> <field name="analytic_account_id" position="after"> <field name="customer_type" required="1" /> - <field name="npwp" placeholder='99.999.999.9-999.999' required="1" /> + <field name="npwp" placeholder='99.999.999.9-999.999' readonly="1" /> <field name="sppkp" attrs="{'required': [('customer_type', '=', 'pkp')]}" /> <field name="email" required="1" /> <field name="unreserve_id" /> |
