[IMP] account_reports: carryover improvements
Implements various small improvements in order to make the carryover functionality a bit less hidden, with a cleaner UX. Task id #2500684 closes odoo/odoo#69762 Related: odoo/enterprise#17908 Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
This commit is contained in:
@@ -120,11 +120,11 @@ class AccountTaxReportLine(models.Model):
|
||||
# The selection should be filled in localizations using the system
|
||||
carry_over_condition_method = fields.Selection(
|
||||
selection=[('no_negative_amount_carry_over_condition', 'No negative amount')],
|
||||
string="Carry over method",
|
||||
string="Carryover method",
|
||||
help="The method used to determine if this line should be carried over."
|
||||
)
|
||||
carry_over_destination_line_id = fields.Many2one(
|
||||
string="Carry over to",
|
||||
string="Carryover to",
|
||||
comodel_name="account.tax.report.line",
|
||||
domain=[('tag_name', '!=', False)],
|
||||
help="The line to which the value of this line will be carried over to if needed."
|
||||
@@ -287,6 +287,23 @@ class AccountTaxReportLine(models.Model):
|
||||
if neg_tags.name != '-'+record.tag_name or pos_tags.name != '+'+record.tag_name:
|
||||
raise ValidationError(_("The tags linked to a tax report line should always match its tag name."))
|
||||
|
||||
def action_view_carryover_lines(self):
|
||||
''' Action when clicking on the "View carryover lines" in the carryover info popup.
|
||||
|
||||
:return: An action showing the account.tax.carryover.lines for the current tax report line.
|
||||
'''
|
||||
self.ensure_one()
|
||||
return {
|
||||
'type': 'ir.actions.act_window',
|
||||
'name': _('Carryover Lines For %s', self.name),
|
||||
'res_model': 'account.tax.carryover.line',
|
||||
'view_type': 'list',
|
||||
'view_mode': 'list',
|
||||
'views': [[self.env.ref('account.account_tax_carryover_line_tree').id, 'list'],
|
||||
[False, 'form']],
|
||||
'domain': [('id', 'in', self.carryover_line_ids.ids)],
|
||||
}
|
||||
|
||||
def _get_carryover_bounds(self, options, line_amount, carried_over_amount):
|
||||
"""
|
||||
Check if the line will be carried over, by checking the condition method set on the line.
|
||||
|
||||
@@ -64,30 +64,54 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="account_tax_carryover_line_form" model="ir.ui.view">
|
||||
<field name="name">account.tax.carryover.line.form</field>
|
||||
<field name="model">account.tax.carryover.line</field>
|
||||
<field name="arch" type="xml">
|
||||
<form>
|
||||
<sheet>
|
||||
<group>
|
||||
<group>
|
||||
<field name="name"/>
|
||||
<field name="tax_report_line_id"/>
|
||||
<field name="tax_report_country_id"/>
|
||||
<field name="foreign_vat_fiscal_position_id"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="date"/>
|
||||
<field name="amount"/>
|
||||
<field name="company_id"/>
|
||||
</group>
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="account_tax_report_line_form" model="ir.ui.view">
|
||||
<field name="name">account.tax.report.line.form</field>
|
||||
<field name="model">account.tax.report.line</field>
|
||||
<field name="arch" type="xml">
|
||||
<form>
|
||||
<sheet>
|
||||
<group>
|
||||
<field name="name"/>
|
||||
</group>
|
||||
<group>
|
||||
<group>
|
||||
<field name="sequence" invisible="1"/>
|
||||
<field name="name"/>
|
||||
<field name="tag_name"/>
|
||||
<field name="code"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="report_id" invisible="1"/>
|
||||
<field name="parent_id" readonly="1"/>
|
||||
<field name="code"/>
|
||||
<field name="formula"/>
|
||||
</group>
|
||||
</group>
|
||||
<group>
|
||||
<field name="formula"/>
|
||||
</group>
|
||||
<group>
|
||||
<group>
|
||||
<field name="carry_over_condition_method"/>
|
||||
<field name="carry_over_condition_method" placeholder="No carryover"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="carry_over_destination_line_id" placeholder="Same report line"/>
|
||||
@@ -97,7 +121,7 @@
|
||||
<page string="Sublines">
|
||||
<field name="children_line_ids" context="{'default_report_id': report_id}"/>
|
||||
</page>
|
||||
<page string="Carry over lines">
|
||||
<page string="Carryover lines">
|
||||
<field name="carryover_line_ids"/>
|
||||
</page>
|
||||
</notebook>
|
||||
|
||||
Reference in New Issue
Block a user