diff options
| author | Rafi Zadanly <zadanlyr@gmail.com> | 2023-10-19 11:34:36 +0700 |
|---|---|---|
| committer | Rafi Zadanly <zadanlyr@gmail.com> | 2023-10-19 11:34:36 +0700 |
| commit | 91d393eb699188b536c3c44d4460f6fed9596d3b (patch) | |
| tree | 85b4693ddf1ba314a9564d7ffacf2098ac237909 | |
| parent | 61afbe62fb03b94263d2e94b2b4b8ada7e60b6f7 (diff) | |
Update due date by payment schedule on bill view
| -rw-r--r-- | indoteknik_custom/models/account_move.py | 5 | ||||
| -rw-r--r-- | indoteknik_custom/views/account_move.xml | 8 |
2 files changed, 11 insertions, 2 deletions
diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py index 207ccee1..a85e8caa 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -14,6 +14,7 @@ _logger = logging.getLogger(__name__) class AccountMove(models.Model): _inherit = 'account.move' invoice_day_to_due = fields.Integer(string="Day to Due", compute="_compute_invoice_day_to_due") + bill_day_to_due = fields.Date(string="Day to Due", compute="_compute_bill_day_to_due") date_send_fp = fields.Datetime(string="Tanggal Kirim Faktur Pajak") last_log_fp = fields.Char(string="Log Terakhir Faktur Pajak") # use for industry business @@ -107,6 +108,10 @@ class AccountMove(models.Model): invoice_day_to_due = invoice.new_due_date - date.today() invoice_day_to_due = invoice_day_to_due.days invoice.invoice_day_to_due = invoice_day_to_due + + def _compute_bill_day_to_due(self): + for rec in self: + rec.bill_day_to_due = rec.payment_schedule or rec.invoice_date_due @api.onchange('date_kirim_tukar_faktur') def change_date_kirim_tukar_faktur(self): diff --git a/indoteknik_custom/views/account_move.xml b/indoteknik_custom/views/account_move.xml index 2aeffc83..1721abb6 100644 --- a/indoteknik_custom/views/account_move.xml +++ b/indoteknik_custom/views/account_move.xml @@ -73,8 +73,12 @@ <field name="model">account.move</field> <field name="inherit_id" ref="account.view_in_invoice_tree"/> <field name="arch" type="xml"> - <field name="payment_state" position="after"> - <field name="payment_schedule" optional="hide"/> + <field name="invoice_date_due" position="after"> + <field name="bill_day_to_due" string="Due Date" widget="remaining_days"/> + </field> + + <field name="invoice_date_due" position="attributes"> + <attribute name="invisible">1</attribute> </field> </field> </record> |
