Skip to content

Commit

Permalink
[IMP] account_payment_group: Mejora transferencias
Browse files Browse the repository at this point in the history
Task: 28369
  • Loading branch information
pablohmontenegro committed Feb 8, 2023
1 parent 61619ce commit acc14b9
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
2 changes: 1 addition & 1 deletion account_payment_group/__manifest__.py
Expand Up @@ -2,7 +2,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Account Payment with Multiple methods",
"version": "15.0.1.4.0",
"version": "15.0.1.5.0",
"category": "Accounting",
"website": "www.adhoc.com.ar",
"author": "ADHOC SA, AITIC S.A.S",
Expand Down
18 changes: 18 additions & 0 deletions account_payment_group/models/account_payment.py
Expand Up @@ -51,6 +51,14 @@ class AccountPayment(models.Model):
compute='_compute_available_journal_ids'
)

label_journal_id = fields.Char(
compute='_compute_label'
)

label_destination_journal_id = fields.Char(
compute='_compute_label'
)

@api.depends('payment_type', 'payment_group_id')
def _compute_available_journal_ids(self):
"""
Expand Down Expand Up @@ -248,3 +256,13 @@ def _create_paired_internal_transfer_payment(self):
super(AccountPayment, rec.with_context(
default_force_amount_company_currency=rec.force_amount_company_currency
))._create_paired_internal_transfer_payment()

@api.onchange("payment_type")
def _compute_label(self):
for rec in self:
if rec.payment_type == "outbound":
rec.label_journal_id = "Diario de origen"
rec.label_destination_journal_id = "Diario de destino"
else:
rec.label_journal_id = "Diario de destino"
rec.label_destination_journal_id = "Diario de origen"
24 changes: 23 additions & 1 deletion account_payment_group/views/account_payment_view.xml
Expand Up @@ -98,6 +98,28 @@
</field>
</record>

<record id="view_account_payment_form2" model="ir.ui.view">
<field name="name">account.payment.form</field>
<field name="model">account.payment</field>
<field name="inherit_id" ref="account.view_account_payment_form"/>
<field name="mode">primary</field>
<field name="arch" type="xml">
<field name="journal_id" position="attributes">
<attribute name="nolabel">1</attribute>
</field>
<field name="destination_journal_id" position="attributes">
<attribute name="nolabel">1</attribute>
</field>
<xpath expr="//field[@name='journal_id']" position="before">
<field name="label_journal_id" nolabel="1"/>
</xpath>

<xpath expr="//field[@name='destination_journal_id']" position="before">
<field name="label_destination_journal_id" nolabel="1"/>
</xpath>
</field>
</record>

<record id="view_account_payment_from_group_form" model="ir.ui.view">
<field name="name">account.payment.from payment group.form</field>
<field name="model">account.payment</field>
Expand Down Expand Up @@ -131,7 +153,7 @@
<field name="name">Transfers</field>
<field name="res_model">account.payment</field>
<field name="view_mode">tree,form,graph</field>
<field name="context">{'default_is_internal_transfer': True, 'default_move_journal_types': ('bank', 'cash')}</field>
<field name="context">{'form_view_ref': 'account_payment_group.view_account_payment_form2', 'default_payment_type': 'outbound', 'default_is_internal_transfer': True, 'default_move_journal_types': ('bank', 'cash')}</field>
<field name="domain">[('is_internal_transfer', '=', 'transfer')]</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Expand Down

0 comments on commit acc14b9

Please sign in to comment.