[IMP] point_of_sale: no CoA error visible for pos

Problem: The error "There is no chart of accounts installed for this company..." appears for POS shop configurations
if they don't have a chart template configured for the company. It doesn't take into account if the company has its
own set of accounts so it will always show the error unless the chart template is set.

Solution: Include an additional condition to check if the company has accounting entries which is used to check
if the company has used its own set of chart of accounts for accounting.

Purpose: The error will only appear if the company has no chart template set or no accounting entries.

opw-3291399

closes odoo/odoo#121474

X-original-commit: 6b866cea2f60dc91f37f06393159db01dedc6db2
Signed-off-by: Laurent Smet <las@odoo.com>
Signed-off-by: Mylyna Hy (myhy) <myhy@odoo.com>
This commit is contained in:
Mylyna Hy
2023-05-18 21:34:53 +02:00
parent 806a4f895e
commit 00f963ebed
+1 -4
View File
@@ -182,10 +182,7 @@ class PosConfig(models.Model):
@api.depends('company_id')
def _compute_company_has_template(self):
for config in self:
if config.company_id.chart_template:
config.company_has_template = True
else:
config.company_has_template = False
config.company_has_template = config.company_id.sudo()._existing_accounting() or config.company_id.chart_template
def _compute_is_installed_account_accountant(self):
account_accountant = self.env['ir.module.module'].sudo().search([('name', '=', 'account_accountant'), ('state', '=', 'installed')])