mirror of
https://gitlab.com/flectra-community/bank-payment.git
synced 2024-12-23 04:41:44 +00:00
Automatic Update form OCA2FC Migrator
This commit is contained in:
parent
78e64c42b5
commit
5e2d1b2287
@ -11,11 +11,11 @@ addon | version | summary
|
||||
--- | --- | ---
|
||||
[account_banking_mandate](account_banking_mandate/) | 2.0.1.1.0| Banking mandates
|
||||
[account_payment_order_return](account_payment_order_return/) | 2.0.1.0.1| Account Payment Order Return
|
||||
[account_payment_order](account_payment_order/) | 2.0.1.2.1| Account Payment Order
|
||||
[account_payment_order](account_payment_order/) | 2.0.1.2.2| Account Payment Order
|
||||
[account_payment_sale](account_payment_sale/) | 2.0.1.0.0| Adds payment mode on sale orders
|
||||
[account_payment_purchase_stock](account_payment_purchase_stock/) | 2.0.1.0.0| Integrate Account Payment Purchase with Stock
|
||||
[account_payment_purchase](account_payment_purchase/) | 2.0.1.0.0| Adds Bank Account and Payment Mode on Purchase Orders
|
||||
[account_payment_partner](account_payment_partner/) | 2.0.1.2.0| Adds payment mode on partners and invoices
|
||||
[account_payment_partner](account_payment_partner/) | 2.0.1.2.1| Adds payment mode on partners and invoices
|
||||
[account_banking_pain_base](account_banking_pain_base/) | 2.0.1.0.0| Base module for PAIN file generation
|
||||
[account_banking_sepa_direct_debit](account_banking_sepa_direct_debit/) | 2.0.1.1.0| Create SEPA files for Direct Debit
|
||||
[account_banking_sepa_credit_transfer](account_banking_sepa_credit_transfer/) | 2.0.1.0.0| Create SEPA XML files for Credit Transfers
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
{
|
||||
"name": "Account Payment Order",
|
||||
"version": "2.0.1.2.1",
|
||||
"version": "2.0.1.2.2",
|
||||
"license": "AGPL-3",
|
||||
"author": "ACSONE SA/NV, "
|
||||
"Therp BV, "
|
||||
|
@ -84,7 +84,7 @@ class AccountMove(models.Model):
|
||||
raise UserError(_("No Payment Mode on invoice %s") % move.name)
|
||||
for payment_mode in payment_modes:
|
||||
payorder = apoo.search(
|
||||
self.get_account_payment_domain(payment_mode), limit=1
|
||||
move.get_account_payment_domain(payment_mode), limit=1
|
||||
)
|
||||
new_payorder = False
|
||||
if not payorder:
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
{
|
||||
"name": "Account Payment Partner",
|
||||
"version": "2.0.1.2.0",
|
||||
"version": "2.0.1.2.1",
|
||||
"category": "Banking addons",
|
||||
"license": "AGPL-3",
|
||||
"summary": "Adds payment mode on partners and invoices",
|
||||
|
@ -80,6 +80,15 @@ class AccountMove(models.Model):
|
||||
partner.supplier_payment_mode_id.refund_payment_mode_id
|
||||
)
|
||||
|
||||
@api.onchange("partner_id")
|
||||
def _onchange_partner_id(self):
|
||||
"""Force compute because the onchange chain doesn't call
|
||||
``_compute_partner_bank``.
|
||||
"""
|
||||
res = super()._onchange_partner_id()
|
||||
self._compute_partner_bank()
|
||||
return res
|
||||
|
||||
@api.depends("partner_id", "payment_mode_id")
|
||||
def _compute_partner_bank(self):
|
||||
for move in self:
|
||||
@ -131,3 +140,14 @@ class AccountMove(models.Model):
|
||||
)
|
||||
# Return this as empty recordset
|
||||
return self.partner_bank_id
|
||||
|
||||
@api.model
|
||||
def create(self, vals):
|
||||
"""Force compute partner_bank_id when invoice is created from SO
|
||||
to avoid that flectra _prepare_invoice method value will be set.
|
||||
"""
|
||||
if self.env.context.get("active_model") == "sale.order": # pragma: no cover
|
||||
virtual_move = self.new(vals)
|
||||
virtual_move._compute_partner_bank()
|
||||
vals["partner_bank_id"] = virtual_move.partner_bank_id
|
||||
return super().create(vals)
|
||||
|
@ -173,7 +173,7 @@ class TestAccountPaymentPartner(SavepointCase):
|
||||
cls.journal_bank = cls.env["res.partner.bank"].create(
|
||||
{
|
||||
"acc_number": "GB95LOYD87430237296288",
|
||||
"partner_id": cls.env.user.company_id.id,
|
||||
"partner_id": cls.env.user.company_id.partner_id.id,
|
||||
}
|
||||
)
|
||||
cls.journal = cls.env["account.journal"].create(
|
||||
@ -228,6 +228,16 @@ class TestAccountPaymentPartner(SavepointCase):
|
||||
self.payment_mode_model,
|
||||
)
|
||||
|
||||
def test_partner_id_changes_compute_partner_bank(self):
|
||||
# Test _compute_partner_bank is executed when partner_id changes
|
||||
move_form = Form(
|
||||
self.env["account.move"].with_context(default_move_type="out_invoice")
|
||||
)
|
||||
self.assertFalse(move_form.partner_bank_id)
|
||||
move_form.partner_id = self.customer
|
||||
self.assertEqual(move_form.payment_mode_id, self.customer_payment_mode)
|
||||
self.assertFalse(move_form.partner_bank_id)
|
||||
|
||||
def test_out_invoice_onchange(self):
|
||||
# Test the onchange methods in invoice
|
||||
invoice = self.move_model.new(
|
||||
|
Loading…
Reference in New Issue
Block a user