From 2f6b2da9144d267c4313124656942d886a43bc5f Mon Sep 17 00:00:00 2001 From: Gert Pellin Date: Mon, 1 Jul 2019 10:05:16 +0000 Subject: [PATCH] [IMP] point_of_sale: Warning no chart of account Point of sale config have multiple fields that depends on the accounting localisation, but when you create a new company, the default values for the journals, accounts, etc are not yet created because there is no chart of account installed for the company. So to avoid user that create a pos config to manually create accounting journals and accounts, we are warning them to install first an accounting localisation that will create them all necessaries account and journals. TASK-ID: 2028954 closes odoo/odoo#35042 Signed-off-by: pimodoo --- addons/point_of_sale/models/pos_config.py | 9 +++++++++ addons/point_of_sale/views/pos_config_view.xml | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/addons/point_of_sale/models/pos_config.py b/addons/point_of_sale/models/pos_config.py index 9a1a84398b3..3f4041c9cbf 100644 --- a/addons/point_of_sale/models/pos_config.py +++ b/addons/point_of_sale/models/pos_config.py @@ -201,6 +201,15 @@ class PosConfig(models.Model): "closing a session, for non-POS managers. If this maximum is reached, the user will have an error message at " "the closing of his session saying that he needs to contact his manager.") payment_method_ids = fields.Many2many('pos.payment.method', string='Payment Methods', default=lambda self: self._default_payment_methods()) + company_has_template = fields.Boolean(string="Company has chart of accounts", compute="_compute_company_has_template") + + @api.depends('company_id') + def _compute_company_has_template(self): + for config in self: + if config.company_id.chart_template_id: + config.company_has_template = True + else: + config.company_has_template = False def _compute_is_installed_account_accountant(self): account_accountant = self.env['ir.module.module'].sudo().search([('name', '=', 'account_accountant'), ('state', '=', 'installed')]) diff --git a/addons/point_of_sale/views/pos_config_view.xml b/addons/point_of_sale/views/pos_config_view.xml index fbed020f0fd..6bd60a08d32 100644 --- a/addons/point_of_sale/views/pos_config_view.xml +++ b/addons/point_of_sale/views/pos_config_view.xml @@ -33,6 +33,7 @@ +