[FIX] account: show tax reports of company's country
The tax adjustment wizard shows tax reports of countries other than the current company's country Steps to reproduce: 1. Install Accounting 2. Go to Accounting > Configuration > Management > Tax Reports 3. Create a report for another country than the current company and add a line with a tag name 4. Go to Accounting > Accounting > Actions > Tax Adjustements (in debug mode) 5. The created tax report line is suggested but it shouldn't Solution: Put the domain of `tax_report_line_id` in python and add a filter on the country opw-2760337 closes odoo/odoo#84854 X-original-commit: cc13d20996f1e0a261829ced91cbbe18d6236fb5 Signed-off-by: William André (wan) <wan@odoo.com>
This commit is contained in:
@@ -20,10 +20,23 @@ class TaxAdjustments(models.TransientModel):
|
||||
domain="[('deprecated', '=', False), ('is_off_balance', '=', False)]")
|
||||
amount = fields.Monetary(currency_field='company_currency_id', required=True)
|
||||
adjustment_type = fields.Selection([('debit', 'Applied on debit journal item'), ('credit', 'Applied on credit journal item')], string="Adjustment Type", required=True)
|
||||
tax_report_line_id = fields.Many2one(string="Report Line", comodel_name='account.tax.report.line', required=True, help="The report line to make an adjustment for.")
|
||||
tax_report_line_id = fields.Many2one(
|
||||
string="Report Line",
|
||||
comodel_name='account.tax.report.line',
|
||||
required=True,
|
||||
domain="[('tag_name', '!=', None), ('report_id.country_id', 'in', fiscal_country_ids)]",
|
||||
help="The report line to make an adjustment for.",
|
||||
)
|
||||
company_currency_id = fields.Many2one('res.currency', readonly=True, default=lambda x: x.env.company.currency_id)
|
||||
report_id = fields.Many2one(string="Report", related='tax_report_line_id.report_id')
|
||||
fiscal_country_ids = fields.Many2many('res.country', compute='_compute_fiscal_country_ids', readonly=True)
|
||||
|
||||
@api.depends('journal_id')
|
||||
def _compute_fiscal_country_ids(self):
|
||||
for record in self:
|
||||
fiscal_position_country_ids = record.env['account.fiscal.position'].search(
|
||||
[('company_id', '=', record.journal_id.company_id.id), ('foreign_vat', '!=', False)]).country_id
|
||||
record.fiscal_country_ids = record.journal_id.company_id.country_id + fiscal_position_country_ids
|
||||
|
||||
def create_move(self):
|
||||
move_line_vals = []
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
</h1>
|
||||
<group>
|
||||
<field name="report_id" invisible="1"/>
|
||||
<field name="tax_report_line_id" options="{'no_open': True, 'no_create': True}" domain="[('tag_name', '!=', None)]"/>
|
||||
<field name="fiscal_country_ids" invisible="1"/>
|
||||
<field name="tax_report_line_id" options="{'no_open': True, 'no_create': True}"/>
|
||||
</group>
|
||||
<group>
|
||||
<group>
|
||||
|
||||
Reference in New Issue
Block a user