Skip to content

Commit

Permalink
últimos cambios
Browse files Browse the repository at this point in the history
  • Loading branch information
pablohmontenegro committed Jan 24, 2024
1 parent 714f24c commit 0e683b0
Show file tree
Hide file tree
Showing 16 changed files with 60 additions and 37 deletions.
1 change: 1 addition & 0 deletions account_tax_settlement/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
'account_reports',
# dependencia porque llevamos a pagos y tmb porque usamos el boton
# en apuntes contables para abrir documento relacionado
'account_payment_pro'
],
'data': [
'wizards/account_tax_settlement_wizard_view.xml',
Expand Down
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
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
1 change: 1 addition & 0 deletions account_tax_settlement/models/account_journal.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def action_create_payment(self):
'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
3 changes: 2 additions & 1 deletion account_tax_settlement/models/account_move_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ def action_pay_tax_settlement(self):
'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
20 changes: 0 additions & 20 deletions account_tax_settlement/models/account_payment.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
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 @@ -17,8 +17,8 @@
</p>
<group>
<field name="date"/>
<field name="settlement_journal_id" invisible="not report_id" required="report_id" domain="[('company_id', '=', company_id), ('type', '=', 'general')]"/>
<field name="account_id" invisible="not report_settlement_allow_unbalanced" required="report_settlement_allow_unbalanced" 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
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
_logger = logging.getLogger(__name__)


class AccountChartTemplate(models.Model):
class AccountChartTemplate(models.AbstractModel):
_inherit = 'account.chart.template'

def _create_bank_journals(self, company, acc_template_ref):
Expand Down
22 changes: 18 additions & 4 deletions l10n_ar_account_tax_settlement/models/account_journal.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,27 @@ class AccountJournal(models.Model):

@api.constrains('settlement_tax')
def check_withholding_autmatic_installed(self):
account_withholding_automatic = self.env['ir.module.module'].search([
('name', '=', 'account_withholding_automatic'),
l10n_ar_withholding_ux = self.env['ir.module.module'].search([
('name', '=', 'l10n_ar_withholding_ux'),
('state', '=', 'installed'),
])
if not account_withholding_automatic and any(self.filtered(
if not l10n_ar_withholding_ux and any(self.filtered(
lambda x: x.settlement_tax in ['iibb_aplicado_api',
'sicore_aplicado'])):
raise ValidationError(_(
'No puede utilizar exportación a "SICORE Aplicado"'
' o "Perc/Ret IIBB aplicadas API"'
' si no tiene instalado el módulo de retenciones'
' automáticas (account_withholding_automatic)'))
' automáticas (l10n_ar_withholding_ux)'))

def check_l10n_ar_account_withholding_installed(self):
l10n_ar_account_withholding_installed = self.env['ir.module.module'].search([
('name', '=', 'l10n_ar_account_withholding'),
('state', '=', 'installed'),
])
if not l10n_ar_account_withholding_installed:
raise ValidationError(_(
'No se encuentra instalado el módulo "l10n_ar_account_withholding"'))

def iibb_aplicado_dgr_mendoza_files_values(self, move_lines):

Expand All @@ -97,6 +106,7 @@ def iibb_aplicado_dgr_mendoza_files_values(self, move_lines):
payment = line.payment_id
move = line.move_id
tax = line.tax_line_id
self.check_l10n_ar_account_withholding_installed()

alicuot_line = tax.get_partner_alicuot(partner, line.date)
if not alicuot_line:
Expand Down Expand Up @@ -203,6 +213,7 @@ def format_amount(amount, integers, decimals=2):
self.ensure_one()
ret = ''
perc = ''
self.check_l10n_ar_account_withholding_installed()

for line in move_lines:
partner = line.partner_id
Expand Down Expand Up @@ -450,6 +461,7 @@ def iibb_aplicado_agip_files_values(self, move_lines):
credito = ''

company_currency = self.company_id.currency_id
self.check_l10n_ar_account_withholding_installed()
for line in move_lines.sorted('date'):

# pay_group = payment.payment_group_id
Expand Down Expand Up @@ -842,6 +854,7 @@ def iibb_aplicado_sircar_files_values(self, move_lines):
'facturas lo cual es requerido para generar el TXT'))

line_nbr = 1
self.check_l10n_ar_account_withholding_installed()
for line in move_lines.filtered('payment_id'):
alicuot_line = line.tax_line_id.get_partner_alicuot(
line.partner_id, line.date)
Expand Down Expand Up @@ -1308,6 +1321,7 @@ def misiones_files_values(self, move_lines):
"""
self.ensure_one()
content = ''
self.check_l10n_ar_account_withholding_installed()
for line in move_lines.sorted(key=lambda r: (r.date, r.id)):
payment = line.payment_id
if payment:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_inflation_adjustment_index_user,inflation.adjustment.index.user,model_inflation_adjustment_index,,1,1,1,1
access_inflation_adjustment_index_user,inflation.adjustment.index.user,model_inflation_adjustment_index,base.group_user,1,1,1,1
access_inflation_adjustment,access_inflation_adjustment,model_inflation_adjustment,base.group_user,1,1,1,1
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class InflationAdjustment(models.TransientModel):
'account.journal',
domain=[('type', '=', 'general')],
required=True,
check_company=True
)
company_id = fields.Many2one(
'res.company',
Expand All @@ -32,6 +33,7 @@ class InflationAdjustment(models.TransientModel):
'account.account',
domain=[('deprecated', '=', False)],
required=True,
check_company=True
)
start_index = fields.Float(
compute='_compute_index',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@
<group colspan="4">
<field name="company_id" invisible="1"/>
<field name="company_id" options="{'no_create': True, 'no_open': True}" groups="base.group_multi_company"/>
<field name="account_id" domain="[('company_id', '=', company_id), ('deprecated', '=', False)]" options="{'no_create': True, 'no_open': True}"/>
<field name="journal_id" domain="[('company_id', '=', company_id)]"/>
<field name="account_id" options="{'no_create': True, 'no_open': True}"/>
<field name="journal_id"/>
</group>
<group colspan="4">
<label for="open_cloure_entry"/>
<div class="o_row">
<field name="open_cloure_entry" widget="radio" nolabel="1"/>
<div attrs="{'invisible': [('open_cloure_entry', '=', 'no')]}">
<div invisible="open_cloure_entry == 'no'">
<label for="closure_move_id"/>
<field name="closure_move_id" attrs="{'required': [('open_cloure_entry', '=', 'yes')]}" options="{'no_create': True, 'no_open': True}"/>
<field name="closure_move_id" required="open_cloure_entry == 'yes'" options="{'no_create': True, 'no_open': True}"/>
</div>
<div attrs="{'invisible': [('open_cloure_entry', '=', 'no')]}">
<div invisible="open_cloure_entry == 'no'">
<label for="open_move_id"/>
<field name="open_move_id" attrs="{'required': [('open_cloure_entry', '=', 'yes')]}" options="{'no_create': True, 'no_open': True}"/>
<field name="open_move_id" required="open_cloure_entry == 'yes'" options="{'no_create': True, 'no_open': True}"/>
</div>
</div>
</group>
Expand Down

0 comments on commit 0e683b0

Please sign in to comment.