diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2024-01-24 16:06:32 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2024-01-24 16:06:32 +0700 |
| commit | 90a388356693f34d259ba95c32d3a6ce11a95d77 (patch) | |
| tree | a7edd1811734a9d0b0fe00aaae469136abe3c500 | |
| parent | ac4337e441fbd575ac8c0a5f43ae77b7e8fbc328 (diff) | |
add new field to account move
| -rw-r--r-- | indoteknik_custom/models/account_move.py | 5 | ||||
| -rwxr-xr-x | indoteknik_custom/models/purchase_order.py | 4 | ||||
| -rw-r--r-- | indoteknik_custom/views/account_move.xml | 3 |
3 files changed, 9 insertions, 3 deletions
diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py index ae09d0ee..948f6e62 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -37,6 +37,7 @@ class AccountMove(models.Model): ], 'Mark Upload Faktur', compute='_compute_mark_upload_efaktur', default='belum_upload') sale_id = fields.Many2one('sale.order', string='Sale Order') reklas_id = fields.Many2one('account.move', string='Nomor CAB', domain="[('partner_id', '=', partner_id)]") + new_invoice_day_to_due = fields.Integer(string="New Day Due", compute="_compute_invoice_day_to_due") def open_form_multi_create_reklas_penjualan(self): action = self.env['ir.actions.act_window']._for_xml_id('indoteknik_custom.action_view_invoice_reklas_penjualan') @@ -132,12 +133,16 @@ class AccountMove(models.Model): def _compute_invoice_day_to_due(self): for invoice in self: invoice_day_to_due = 0 + new_invoice_day_to_due = 0 if invoice.payment_state not in ['paid', 'in_payment', 'reversed'] and invoice.invoice_date_due: invoice_day_to_due = invoice.invoice_date_due - date.today() + new_invoice_day_to_due = invoice.invoice_date_due - date.today() if invoice.new_due_date: invoice_day_to_due = invoice.new_due_date - date.today() invoice_day_to_due = invoice_day_to_due.days + new_invoice_day_to_due = new_invoice_day_to_due.days invoice.invoice_day_to_due = invoice_day_to_due + invoice.new_invoice_day_to_due = new_invoice_day_to_due def _compute_bill_day_to_due(self): for rec in self: diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index 984c8a23..ebadff06 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -302,9 +302,9 @@ class PurchaseOrder(models.Model): res = super(PurchaseOrder, self).button_confirm() current_time = datetime.now() - if self.total_percent_margin < self.total_so_percent_margin and not self.env.user.is_purchasing_manager or not self.env.user.is_leader: + if self.total_percent_margin < self.total_so_percent_margin and not self.env.user.is_purchasing_manager and not self.env.user.is_leader: raise UserError("Beda Margin dengan Sales, harus approval Manager") - if not self.sale_order_id and not self.env.user.is_purchasing_manager or not self.env.user.is_leader: + if not self.sale_order_id and not self.env.user.is_purchasing_manager and not self.env.user.is_leader: raise UserError("Tidak ada link dengan SO, harus approval Manager") send_email = False self.add_product_to_pricelist() diff --git a/indoteknik_custom/views/account_move.xml b/indoteknik_custom/views/account_move.xml index 449a048d..677a1d99 100644 --- a/indoteknik_custom/views/account_move.xml +++ b/indoteknik_custom/views/account_move.xml @@ -64,7 +64,8 @@ </field> <field name="invoice_date_due" position="after"> <field name="new_due_date" optional="hide"/> - <field name="invoice_day_to_due" attrs="{'invisible': [['payment_state', 'in', ('paid', 'in_payment', 'reversed')]]}"/> + <field name="invoice_day_to_due" attrs="{'invisible': [['payment_state', 'in', ('paid', 'in_payment', 'reversed')]]}" optional="hide"/> + <field name="new_invoice_day_to_due" attrs="{'invisible': [['payment_state', 'in', ('paid', 'in_payment', 'reversed')]]}" optional="hide"/> <field name="mark_upload_efaktur" optional="hide" widget="badge" decoration-danger="mark_upload_efaktur == 'belum_upload'" decoration-success="mark_upload_efaktur == 'sudah_upload'" /> |
