Skip to content

Commit

Permalink
[MIG] l10n_ar_account_tax_settlement: Migration to 17.0
Browse files Browse the repository at this point in the history
closes #287

Signed-off-by: Juan José Scarafía <jjs@adhoc.com.ar>
  • Loading branch information
pablohmontenegro committed Mar 15, 2024
1 parent b437bba commit 9e9dc3c
Show file tree
Hide file tree
Showing 25 changed files with 235 additions and 232 deletions.
2 changes: 1 addition & 1 deletion account_tax_settlement/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
'account_reports',
# dependencia porque llevamos a pagos y tmb porque usamos el boton
# en apuntes contables para abrir documento relacionado
'account_payment_group',
'account_payment_pro'
],
'data': [
'wizards/account_tax_settlement_wizard_view.xml',
Expand Down
12 changes: 0 additions & 12 deletions account_tax_settlement/migrations/15.0.1.3.0/post-migration.py

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion account_tax_settlement/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
from . import account_move
from . import account_journal_dashboard
from . import account_report
from . import account_payment_group
from . import account_generic_tax_report
from . import res_partner
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class GenericTaxReportCustomHandler(models.AbstractModel):
_inherit = 'account.generic.tax.report.handler'

def _custom_options_initializer(self, report, options, previous_options=None):
""" Se borra boton tax closing ('Cierre de impuestos') en tax report ('Reporte de impuestos'). """
super()._custom_options_initializer(report, options, previous_options=previous_options)
for x in (options['buttons']):
if x.get('action') == 'action_periodic_vat_entries':
Expand Down
3 changes: 2 additions & 1 deletion account_tax_settlement/models/account_journal.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,14 @@ def action_create_payment(self):
'name': _('Register Payment'),
'view_type': 'form',
'view_mode': 'form',
'res_model': 'account.payment.group',
'res_model': 'account.payment',
'view_id': False,
'target': 'current',
'type': 'ir.actions.act_window',
'context': {
'default_partner_id': partner.id,
'default_partner_type': 'supplier',
'default_payment_type': 'outbound'
},
}

Expand Down
3 changes: 3 additions & 0 deletions account_tax_settlement/models/account_journal_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def _get_journal_dashboard_data_batched(self):
return res

def _fill_tax_settlement_dashboard_data(self, dashboard_data):
""" En diarios de liquidación en vista kanban agregamos al lado del botoncitos 'Líneas a liquidar' la cantidad de líneas de liquidar y el importe y al lado del botoncito 'Saldo a pagar' agregamos el importe """
tax_settlement_journals = self.filtered(lambda journal: journal.tax_settlement != False)
if not tax_settlement_journals:
return
Expand All @@ -33,10 +34,12 @@ def open_action(self):
tax_settlement = self._context.get('tax_settlement', False)
debt_balance = self._context.get('debt_balance', False)
if tax_settlement:
# Ingresa aquí al entrar en vista Kanban en diario de liquidacion en el botoncito "Líneas a liquidar"
action = self.env["ir.actions.actions"]._for_xml_id('account_tax_settlement.action_account_tax_move_line')
action['domain'] = self._get_tax_settlement_lines_domain_by_tags()
return action
elif debt_balance and self.settlement_partner_id:
# Ingresa aquí al entrar en vista Kanban en diario de liquidacion en el botoncito 'Saldo a pagar'
action = self.settlement_partner_id.open_partner_ledger()
ctx = safe_eval(action.get('context'))
ctx.update({
Expand Down
5 changes: 3 additions & 2 deletions account_tax_settlement/models/account_move_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,13 @@ def action_pay_tax_settlement(self):
return {
'name': _('Register Payment'),
'view_mode': 'form',
'res_model': 'account.payment.group',
'res_model': 'account.payment',
'target': 'current',
'type': 'ir.actions.act_window',
'context': {
'default_partner_type': 'supplier',
'default_partner_id': open_move_line_ids.mapped('partner_id').id,
'default_to_pay_move_line_ids': open_move_line_ids.ids,
'default_payment_type': 'outbound',
# We set this because if became from other view and in the context has 'create=False'
# you can't crate payment lines (for ej: subscription)
'create': True,
Expand All @@ -121,6 +121,7 @@ def action_pay_tax_settlement(self):
# por defecto, en pago de retenciones, no hacemos double
# validation
'force_simple': True,
'default_partner_id': open_move_line_ids.mapped('partner_id').id,
},
}

Expand Down
14 changes: 0 additions & 14 deletions account_tax_settlement/models/account_payment_group.py

This file was deleted.

2 changes: 1 addition & 1 deletion account_tax_settlement/models/account_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class AccountReport(models.AbstractModel):
_inherit = 'account.report'

allow_settlement = fields.Boolean(
help='This optin will enable a new button on this report to settle all the lines that are of engine "domain".')
help='This option will enable a new button on this report to settle all the lines that are of engine "domain".')
settlement_title = fields.Char(translate=True)
settlement_allow_unbalanced = fields.Boolean(
help='If you enble this option, then an account will be required when creating the settlement entry and '
Expand Down
16 changes: 16 additions & 0 deletions account_tax_settlement/models/res_partner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from odoo import models


class ResPartner(models.Model):
_name = 'res.partner'
_inherit = 'res.partner'


def open_partner_ledger(self):
""" Heredamos y modificamos el método original que está en account reports y lo dejamos como estaba en 16 para que al momento de hacer click en 'Saldo a pagar' en algún diario de liquidación de impuestos entonces se abra el libro mayor de empresas para el partner de liquidación, caso contrario, se van a visualizar los asientos contables de las liquidaciones de impuestos de ese diario propiamente dicho. Este método se llama en ../account_journal_dashboard.py en el método open_action. """
action = self.env["ir.actions.actions"]._for_xml_id("account_reports.action_account_report_partner_ledger")
action['params'] = {
'options': {'partner_ids': [self.id]},
'ignore_session': 'both',
}
return action
10 changes: 5 additions & 5 deletions account_tax_settlement/views/account_journal_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
<field name="inherit_id" ref="account.view_account_journal_form"/>
<field name="arch" type="xml">
<field name="type" position="after">
<field name="tax_settlement" attrs="{'invisible': [('type', '!=','general')]}"/>
<field name="tax_settlement" invisible="type != 'general'"/>
<!-- <field name="settlement_file_template" attrs="{'invisible': [('tax_settlement', '=', False)]}"/> -->
<field name="settlement_tax" attrs="{'invisible': [('tax_settlement', '=', False)]}"/>
<field name="settlement_partner_id" attrs="{'invisible': [('tax_settlement', '=', False)], 'required': [('tax_settlement', '!=', False)]}"/>
<field name="settlement_account_id" attrs="{'required': [('type', '=','general'), ('tax_settlement', '!=', False)], 'invisible': ['|', ('type', '!=','general'), ('tax_settlement', '=', False)]}" groups="account.group_account_readonly"/>
<field name="settlement_account_tag_ids" attrs="{'invisible': [('tax_settlement', '=', False)]}" widget="many2many_tags"/>
<field name="settlement_tax" invisible="not tax_settlement"/>
<field name="settlement_partner_id" invisible="not tax_settlement" required="tax_settlement"/>
<field name="settlement_account_id" invisible="type != 'general' or not tax_settlement" required="type == 'general' and tax_settlement" groups="account.group_account_readonly"/>
<field name="settlement_account_tag_ids" invisible="not tax_settlement" widget="many2many_tags"/>
</field>
</field>
</record>
Expand Down
6 changes: 3 additions & 3 deletions account_tax_settlement/views/account_move_line_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@
</field>
<tree>
<field name="tax_state"/>
<button name="button_create_tax_settlement_entry" icon="fa-arrow-right" help="Make a move to settle current tax line" attrs="{'invisible': [('tax_state', '!=', 'to_settle')]}" type="object" string="Settle" />
<button name="action_open_tax_settlement_entry" icon="fa-external-link" help="Open Settlement Entry" attrs="{'invisible': [('tax_state', 'not in', ['to_pay', 'paid'])]}" type="object" string="Open" />
<button name="action_pay_tax_settlement" icon="fa-dollar" string="Pay" attrs="{'invisible': [('tax_state', '!=', 'to_pay')]}" type="object"/>
<button name="button_create_tax_settlement_entry" icon="fa-arrow-right" help="Make a move to settle current tax line" invisible="tax_state != 'to_settle'" type="object" string="Settle" />
<button name="action_open_tax_settlement_entry" icon="fa-external-link" help="Open Settlement Entry" invisible="tax_state not in ['to_pay', 'paid']" type="object" string="Open" />
<button name="action_pay_tax_settlement" icon="fa-dollar" string="Pay" invisible="tax_state != 'to_pay'" type="object"/>
</tree>
</field>
</record>
Expand Down
4 changes: 2 additions & 2 deletions account_tax_settlement/views/account_move_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<field name="arch" type="xml">
<div class="oe_button_box">
<field name="settled_line_ids" invisible="1"/>
<button name="%(account.action_account_moves_all_a)d" class="oe_stat_button" icon="fa-bars" type="action" context="{'search_default_tax_settlement_move_id': id}" string="View settled entries" attrs="{'invisible': [('settled_line_ids', '=', [])]}"/>
<button name="download_tax_settlement_file" class="oe_stat_button" icon="fa-download" type="object" string="Download Tax Settlement File" attrs="{'invisible': [('settled_line_ids', '=', [])]}"/>
<button name="%(account.action_account_moves_all_a)d" class="oe_stat_button" icon="fa-bars" type="action" context="{'search_default_tax_settlement_move_id': id}" string="View settled entries" invisible="not settled_line_ids"/>
<button name="download_tax_settlement_file" class="oe_stat_button" icon="fa-download" type="object" string="Download Tax Settlement File" invisible="not settled_line_ids"/>
</div>
</field>
</record>
Expand Down
4 changes: 2 additions & 2 deletions account_tax_settlement/views/account_report_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<field name="arch" type="xml">
<field name="filter_date_range" position="before">
<field name="allow_settlement"/>
<field name="settlement_title" attrs="{'invisible': [('allow_settlement', '=', False)], 'required': [('allow_settlement', '!=', False)]}"/>
<field name="settlement_allow_unbalanced" attrs="{'invisible': [('allow_settlement', '=', False)]}"/>
<field name="settlement_title" invisible="not allow_settlement" required="allow_settlement"/>
<field name="settlement_allow_unbalanced" invisible="not allow_settlement"/>
</field>
</field>
</record>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ class AccountTaxSettlementWizard(models.TransientModel):
settlement_journal_id = fields.Many2one(
'account.journal',
string='Journal',
check_company=True,
domain=[('type', '=', 'general')]
)
report_id = fields.Many2one(
'account.report',
Expand All @@ -39,6 +41,8 @@ class AccountTaxSettlementWizard(models.TransientModel):
)
account_id = fields.Many2one(
'account.account',
check_company=True,
domain=[('deprecated', '=', False)]
)
report_settlement_allow_unbalanced = fields.Boolean(
related='report_id.settlement_allow_unbalanced',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
<field name="report_id" invisible="1"/>
<field name="report_settlement_allow_unbalanced" invisible="1"/>
<field name="move_line_ids" invisible="1"/>
<p attrs="{'invisible': [('report_id', '=', False)]}">
<p invisible="not report_id">
Se va a crear un asiento de liquidación con la información del reporte. Desea continuar?
</p>
<p attrs="{'invisible': [('report_id', '!=', False)]}">
<p invisible="report_id">
Se va a crear un asiento de liquidación para los apuntes seleccionados. Desea continuar?
</p>
<group>
<field name="date"/>
<field name="settlement_journal_id" attrs="{'invisible': [('report_id', '=', False)], 'required': [('report_id', '!=', False)]}" domain="[('company_id', '=', company_id), ('type', '=', 'general')]"/>
<field name="account_id" attrs="{'invisible': [('report_settlement_allow_unbalanced', '=', False)], 'required': [('report_settlement_allow_unbalanced', '!=', False)]}" domain="[('company_id', '=', company_id), ('deprecated', '=', False)]"/>
<field name="settlement_journal_id" invisible="not report_id" required="report_id"/>
<field name="account_id" invisible="not report_settlement_allow_unbalanced" required="report_settlement_allow_unbalanced"/>
</group>
<footer>
<button name="confirm" string="Confirm" type="object" class="oe_highlight"/>
Expand Down
4 changes: 2 additions & 2 deletions l10n_ar_account_tax_settlement/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
##############################################################################
{
'name': 'Tax Settlements For Argentina',
'version': "16.0.1.6.0",
'version': "17.0.1.0.0",
'category': 'Accounting',
'website': 'www.adhoc.com.ar',
'license': 'LGPL-3',
Expand All @@ -41,7 +41,7 @@
],
'test': [
],
'installable': False,
'installable': True,
'auto_install': True,
'application': False,
}
Loading

0 comments on commit 9e9dc3c

Please sign in to comment.