purchase_advance_payment: fix fill amount button - rename, restyle, fix constraint

- Rename button "Fill amount" to "Pay order due amount" / "Plati dospjeli iznos ponude"
- Change button style from btn-link to btn-secondary for better visibility
- Fix @api.constrains to allow zero amount (prevents error on form save before action)
- Move positive amount validation to make_advance_payment method
- Update .pot and bs.po translations

🤖 assisted by claude
This commit is contained in:
Ernad Husremovic 2026-02-11 10:55:19 +01:00
parent 889c53de60
commit 1f9a23aabd
4 changed files with 8 additions and 6 deletions

View file

@ -114,8 +114,8 @@ msgstr "Prikazani naziv"
#. module: purchase_advance_payment #. module: purchase_advance_payment
#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.view_account_voucher_wizard #: model_terms:ir.ui.view,arch_db:purchase_advance_payment.view_account_voucher_wizard
msgid "Fill amount" msgid "Pay order due amount"
msgstr "Popuni iznos" msgstr "Plati dospjeli iznos ponude"
#. module: purchase_advance_payment #. module: purchase_advance_payment
#: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__id #: model:ir.model.fields,field_description:purchase_advance_payment.field_account_voucher_wizard_purchase__id

View file

@ -118,7 +118,7 @@ msgstr ""
#. module: purchase_advance_payment #. module: purchase_advance_payment
#: model_terms:ir.ui.view,arch_db:purchase_advance_payment.view_account_voucher_wizard #: model_terms:ir.ui.view,arch_db:purchase_advance_payment.view_account_voucher_wizard
msgid "Fill amount" msgid "Pay order due amount"
msgstr "" msgstr ""
#. module: purchase_advance_payment #. module: purchase_advance_payment

View file

@ -85,7 +85,7 @@ class AccountVoucherWizardPurchase(models.TransientModel):
@api.constrains("amount_advance") @api.constrains("amount_advance")
def check_amount(self): def check_amount(self):
if self.journal_currency_id.compare_amounts(self.amount_advance, 0.0) <= 0: if self.journal_currency_id.compare_amounts(self.amount_advance, 0.0) < 0:
raise exceptions.ValidationError(_("Amount of advance must be positive.")) raise exceptions.ValidationError(_("Amount of advance must be positive."))
if self.env.context.get("active_id", False): if self.env.context.get("active_id", False):
if ( if (
@ -180,6 +180,8 @@ class AccountVoucherWizardPurchase(models.TransientModel):
def make_advance_payment(self): def make_advance_payment(self):
"""Create customer paylines and validates the payment""" """Create customer paylines and validates the payment"""
self.ensure_one() self.ensure_one()
if self.journal_currency_id.compare_amounts(self.amount_advance, 0.0) <= 0:
raise exceptions.ValidationError(_("Amount of advance must be positive."))
payment_obj = self.env["account.payment"] payment_obj = self.env["account.payment"]
purchase_obj = self.env["purchase.order"] purchase_obj = self.env["purchase.order"]

View file

@ -24,9 +24,9 @@
<field name="amount_total" string="Order Due Amount" /> <field name="amount_total" string="Order Due Amount" />
<button <button
name="action_fill_amount" name="action_fill_amount"
string="Fill amount" string="Pay order due amount"
type="object" type="object"
class="btn-link" class="btn-secondary"
/> />
<field name="currency_id" invisible="1" /> <field name="currency_id" invisible="1" />
</group> </group>