Skip to content

Commit

Permalink
[FIX] account_interest: Fix in analytic line ids for invoice line
Browse files Browse the repository at this point in the history
  • Loading branch information
rov-adhoc committed May 7, 2024
1 parent c7de8e4 commit 8f6a03f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion account_interests/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
##############################################################################
{
'name': 'Interests Management',
'version': "16.0.1.0.0",
'version': "16.0.1.1.0",
'category': 'Accounting',
'sequence': 14,
'summary': 'Calculate interests for selected partners',
Expand Down
2 changes: 1 addition & 1 deletion account_interests/i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ msgid "Additional Filters"
msgstr "Filtros Adicionales"

#. module: account_interests
#: model:ir.model.fields,field_description:account_interests.field_res_company_interest__analytic_line_ids
#: model:ir.model.fields,field_description:account_interests.field_res_company_interest__analytic_account_id
msgid "Analytic account"
msgstr ""

Expand Down
5 changes: 3 additions & 2 deletions account_interests/models/res_company_interest.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class ResCompanyInterest(models.Model):
'Interest Product',
required=True,
)
analytic_line_ids = fields.Many2one(
analytic_account_id = fields.Many2one(
'account.analytic.account',
'Analytic account',
)
Expand Down Expand Up @@ -188,6 +188,7 @@ def create_invoices(self, to_date, groupby='partner_id'):
partner, debt, to_date, journal)

move = self.env['account.move'].create(move_vals)
move.invoice_line_ids._create_analytic_lines()

if self.automatic_validation:
try:
Expand Down Expand Up @@ -236,7 +237,7 @@ def _prepare_interest_invoice(self, partner, debt, to_date, journal):
"price_unit": self.rate * debt,
"partner_id": partner.id,
"name": self.interest_product_id.name + '.\n' + comment,
"analytic_line_ids": [(self.analytic_line_ids.id, )] if self.analytic_line_ids.id else False,
"analytic_distribution": {self.analytic_account_id.id: 100.0} if self.analytic_account_id.id else False,
"tax_ids": [(6, 0, tax_id.ids)]
})],
}
Expand Down
4 changes: 2 additions & 2 deletions account_interests/views/res_company_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<field name="company_id" invisible="1" required="0"/>
<field name="receivable_account_ids" widget="many2many_tags"/>
<field name="interest_product_id"/>
<field name="analytic_line_ids" groups="analytic.group_analytic_accounting"/>
<field name="analytic_account_id" groups="analytic.group_analytic_accounting"/>
<field name="rate"/>
<field name="automatic_validation"/>
<field name="interval"/>
Expand All @@ -29,7 +29,7 @@
<field name="company_id" invisible="1" required="0"/>
<field name="receivable_account_ids" widget="many2many_tags"/>
<field name="interest_product_id"/>
<field name="analytic_line_ids" groups="analytic.group_analytic_accounting"/>
<field name="analytic_account_id" groups="analytic.group_analytic_accounting"/>
</group>
<group>
<field name="rate"/>
Expand Down

0 comments on commit 8f6a03f

Please sign in to comment.