mirror of
https://github.com/bringout/oca-purchase.git
synced 2026-04-20 00:42:00 +02:00
Add "Fill amount" button to advance payment wizard
Adds a button next to "Order Due Amount" that fills the advance
amount with the full order due amount, converting currency if needed.
🤖 assisted by claude
This commit is contained in:
parent
d11a2df53b
commit
889c53de60
4 changed files with 37 additions and 0 deletions
|
|
@ -112,6 +112,11 @@ msgstr "Datum"
|
|||
msgid "Display Name"
|
||||
msgstr "Prikazani naziv"
|
||||
|
||||
#. module: purchase_advance_payment
|
||||
#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.view_account_voucher_wizard
|
||||
msgid "Fill amount"
|
||||
msgstr "Popuni iznos"
|
||||
|
||||
#. module: purchase_advance_payment
|
||||
#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__id
|
||||
msgid "ID"
|
||||
|
|
|
|||
|
|
@ -116,6 +116,11 @@ msgstr ""
|
|||
msgid "Display Name"
|
||||
msgstr ""
|
||||
|
||||
#. module: purchase_advance_payment
|
||||
#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.view_account_voucher_wizard
|
||||
msgid "Fill amount"
|
||||
msgstr ""
|
||||
|
||||
#. module: purchase_advance_payment
|
||||
#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__id
|
||||
msgid "ID"
|
||||
|
|
|
|||
|
|
@ -156,6 +156,27 @@ class AccountVoucherWizardPurchase(models.TransientModel):
|
|||
"payment_method_line_id": self.payment_method_line_id.id,
|
||||
}
|
||||
|
||||
def action_fill_amount(self):
|
||||
"""Fill advance amount with the order due amount (converted to journal currency)."""
|
||||
self.ensure_one()
|
||||
if self.journal_currency_id != self.currency_id:
|
||||
amount = self.currency_id._convert(
|
||||
self.amount_total,
|
||||
self.journal_currency_id,
|
||||
self.order_id.company_id,
|
||||
self.date or fields.Date.today(),
|
||||
)
|
||||
else:
|
||||
amount = self.amount_total
|
||||
self.amount_advance = amount
|
||||
return {
|
||||
"type": "ir.actions.act_window",
|
||||
"res_model": self._name,
|
||||
"res_id": self.id,
|
||||
"view_mode": "form",
|
||||
"target": "new",
|
||||
}
|
||||
|
||||
def make_advance_payment(self):
|
||||
"""Create customer paylines and validates the payment"""
|
||||
self.ensure_one()
|
||||
|
|
|
|||
|
|
@ -22,6 +22,12 @@
|
|||
/>
|
||||
<field name="available_payment_method_line_ids" invisible="1" />
|
||||
<field name="amount_total" string="Order Due Amount" />
|
||||
<button
|
||||
name="action_fill_amount"
|
||||
string="Fill amount"
|
||||
type="object"
|
||||
class="btn-link"
|
||||
/>
|
||||
<field name="currency_id" invisible="1" />
|
||||
</group>
|
||||
<group>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue