diff options
| -rw-r--r-- | indoteknik_custom/models/res_partner.py | 5 | ||||
| -rwxr-xr-x | indoteknik_custom/models/sale_order.py | 19 | ||||
| -rw-r--r-- | indoteknik_custom/views/res_partner.xml | 4 | ||||
| -rwxr-xr-x | indoteknik_custom/views/sale_order.xml | 3 |
4 files changed, 31 insertions, 0 deletions
diff --git a/indoteknik_custom/models/res_partner.py b/indoteknik_custom/models/res_partner.py index 77abaaf9..08e5b9e8 100644 --- a/indoteknik_custom/models/res_partner.py +++ b/indoteknik_custom/models/res_partner.py @@ -13,6 +13,11 @@ class ResPartner(models.Model): company_type_id = fields.Many2one('res.partner.company_type', string='Company Type') custom_pricelist_id = fields.Many2one('product.pricelist', string='Price Matrix') group_partner_id = fields.Many2one('group.partner', string='Group Partner') + customer_type = fields.Selection([ + ('pkp', 'PKP'), + ('non_pkp', 'Non PKP') + ]) + sppkp = fields.Char(string="SPPKP") def unlink(self): if self._name == 'res.partner': diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index d531c869..6a040ff3 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -79,6 +79,13 @@ class SaleOrder(models.Model): grand_total = fields.Monetary(string='Grand Total', help='Amount total + amount delivery', compute='_compute_grand_total') payment_link_midtrans = fields.Char(string='Payment Link', help='Url payment yg digenerate oleh midtrans, harap diserahkan ke customer agar dapat dilakukan pembayaran secara mandiri') due_id = fields.Many2one('due.extension', string="Due Extension", readonly=True) + customer_type = fields.Selection([ + ('pkp', 'PKP'), + ('nonpkp', 'Non PKP') + ]) + sppkp = fields.Char(string="SPPKP") + npwp = fields.Char(string="NPWP") + def generate_payment_link_midtrans_sales_order(self): # midtrans_url = 'https://app.sandbox.midtrans.com/snap/v1/transactions' # dev - sandbox @@ -423,6 +430,17 @@ class SaleOrder(models.Model): } } + def _set_sppkp_npwp_contact(self): + for contact in self: + partner_customer_type = contact.customer_type + contact.partner_id.customer_type = partner_customer_type + + partner_npwp = contact.npwp + contact.partner_id.npwp = partner_npwp + + partner_sppkp = contact.sppkp + contact.partner_id.sppkp = partner_sppkp + def action_confirm(self): for order in self: if order.warehouse_id.id != 8: #GD Bandengan @@ -451,6 +469,7 @@ class SaleOrder(models.Model): elif order._notification_margin_manager(): return self._notification_has_margin_manager() else: + order._set_sppkp_npwp_contact() order.approval_status = 'approved' order.calculate_line_no() diff --git a/indoteknik_custom/views/res_partner.xml b/indoteknik_custom/views/res_partner.xml index a9372da0..341d0076 100644 --- a/indoteknik_custom/views/res_partner.xml +++ b/indoteknik_custom/views/res_partner.xml @@ -7,12 +7,16 @@ <field name="inherit_id" ref="base.view_partner_form"/> <field name="arch" type="xml"> <field name="vat" position="after"> + <field name="sppkp"/> <field name="reference_number"/> </field> <field name="industry_id" position="after"> <field name="company_type_id"/> <field name="group_partner_id"/> </field> + <field name="vat" position="before"> + <field name="customer_type"/> + </field> </field> </record> </data> diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml index 222fb057..450b3303 100755 --- a/indoteknik_custom/views/sale_order.xml +++ b/indoteknik_custom/views/sale_order.xml @@ -27,6 +27,9 @@ <field name="total_percent_margin"/> </field> <field name="analytic_account_id" position="after"> + <field name="customer_type" required="1"/> + <field name="sppkp" attrs="{'invisible': [('customer_type','!=','pkp')], 'required': [('customer_type','=','pkp')]}"/> + <field name="npwp" attrs="{'invisible': [('customer_type','!=','pkp')], 'required': [('customer_type','=','pkp')]}"/> <field name="due_id" readonly="1"/> </field> <field name="partner_shipping_id" position="after"> |
