Skip to content

Commit

Permalink
[MIG] internal_transfer_with_agreed_amount: Migration to 17.0
Browse files Browse the repository at this point in the history
Changelog:
- Replace `attrs` with an expression for the `invisible` attribute in
  the view.
- Add payment amount and currency update after the move is set to draft.
  This is because the undoing of the reconciliation triggers an update
  on the payment, and the amount gets updated to the previous agreed
  amount along with its corresponding currency. This happens when the
  agreed amount is edited.
- Enable the euro currency in the test since it's required for
  multicurrency transfers.
- Update translations file.
  • Loading branch information
CLaurelB committed Jun 18, 2024
1 parent 483325e commit 64c240c
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 23 deletions.
2 changes: 1 addition & 1 deletion internal_transfer_with_agreed_amount/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Internal transfers with an agreed amount",
"version": "16.0.1.0.0",
"version": "17.0.1.0.0",
"author": "Vauxoo",
"website": "http://www.vauxoo.com/",
"license": "LGPL-3",
Expand Down
11 changes: 3 additions & 8 deletions internal_transfer_with_agreed_amount/i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0+e\n"
"Project-Id-Version: Odoo Server 17.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-09-18 16:40+0000\n"
"PO-Revision-Date: 2023-09-18 16:40+0000\n"
"POT-Creation-Date: 2024-06-18 15:42+0000\n"
"PO-Revision-Date: 2024-06-18 15:42+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
Expand Down Expand Up @@ -91,11 +91,6 @@ msgstr "Complete con el monto total que recibirá por esta operación"
msgid "ID"
msgstr ""

#. module: internal_transfer_with_agreed_amount
#: model:ir.model.fields,field_description:internal_transfer_with_agreed_amount.field_internal_transfer_multicurrency____last_update
msgid "Last Modified on"
msgstr "Última modificación en"

#. module: internal_transfer_with_agreed_amount
#: model:ir.model.fields,field_description:internal_transfer_with_agreed_amount.field_internal_transfer_multicurrency__write_uid
msgid "Last Updated by"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ def setUpClass(cls):
main_company.transfer_account_id.write({"reconcile": True})
cls.currency = main_company.currency_id
cls.currency_eur = cls.env.ref("base.EUR")
cls.currency_eur.active = True
bank = cls.env["account.journal"].search([("type", "=", "bank")], limit=1)
cls.bank_journal = bank.copy()
cls.bank_journal.write({"name": "Bank " + cls.currency.name, "code": "BNK68"})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,15 @@
class="oe_highlight"
string="Confirm with an agreed amount"
groups="internal_transfer_with_agreed_amount.allow_confirm_internal_transfer_with_agreed_amount"
attrs="{
'invisible': [
'|',
('is_internal_transfer', '=', False),
('state', '!=', 'draft')
]
}"
invisible="not is_internal_transfer or state != 'draft'"
/>
<button
name="internal_transfer_with_agreed_amount.action_internal_transfer_multicurrency"
type="action"
class="oe_highlight"
string="Edit agreed amount"
groups="internal_transfer_with_agreed_amount.allow_confirm_internal_transfer_with_agreed_amount"
attrs="{
'invisible':[
'|',
('is_internal_transfer', '=', False),
('state', 'in', ('draft', 'cancelled'))
]
}"
invisible="not is_internal_transfer or state in ('draft', 'cancelled')"
/>
</xpath>
</field>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ def apply(self):
aml_negative = amls.filtered(lambda a: a.amount_currency < 0.00)
if len(aml_positive) > 2 or len(aml_negative) > 2:
return
payment_vals = {"amount": payment.amount, "currency_id": payment.currency_id.id}
aml_positive.move_id.button_draft()
payment.write(payment_vals)
self._preprocess_payments_hooks(payment)
vals = self._prepare_values_from_lines(aml_positive, exchange_currency)
aml_positive.with_context(**context).write(vals)
Expand Down

0 comments on commit 64c240c

Please sign in to comment.