Skip to content

Commit

Permalink
[IMP] base, account: remove l10n install banner from company
Browse files Browse the repository at this point in the history
Before this commit:
Whenever `accounting` or `HR` module was installed,
A blue banner was visible on company form if the
available localisation were not installed based on
company country

After this commit:
We don't show install l10n modules banner
instead only if `accounting` is installed
and Chart of Account is not installed for
the company then config banner is visible
on company which will redirect the user
to Account Setting to set up the Chart
of Account

task-3778290
  • Loading branch information
hamo-odoo committed Mar 26, 2024
1 parent 7bdc33d commit a2a3e1b
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 12 deletions.
11 changes: 11 additions & 0 deletions addons/account/models/company.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,17 @@ def write(self, values):

return super(ResCompany, self).write(values)

def action_config_account(self):
return {
'type': 'ir.actions.act_window',
'res_model': 'res.config.settings',
'view_mode': 'form',
'context': {
'module': 'account',
'default_company_id': self.id,
},
}

@api.model
def setting_init_bank_account_action(self):
""" Called by the 'Bank Accounts' button of the setup bar or from the Financial configuration menu."""
Expand Down
10 changes: 10 additions & 0 deletions addons/account/views/res_company_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@
<field name="message_ids"/>
</div>
</xpath>
<xpath expr="//sheet" position="before">
<field name="chart_template" invisible="1"/>
<div class="alert alert-info" role="alert" invisible="chart_template or not country_id">
Localization features are available for this country:
<button name="action_config_account"
type="object"
string="Go to Configuration Now"
class="btn btn-link p-0 align-baseline"/>
</div>
</xpath>
</field>
</record>

Expand Down
4 changes: 1 addition & 3 deletions odoo/addons/base/models/res_company.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ def _default_currency_id(self):
color = fields.Integer(compute='_compute_color', inverse='_inverse_color')
layout_background = fields.Selection([('Blank', 'Blank'), ('Geometric', 'Geometric'), ('Custom', 'Custom')], default="Blank", required=True)
layout_background_image = fields.Binary("Background Image")
# TODO: Remove uninstalled_l10n_module_ids in master
uninstalled_l10n_module_ids = fields.Many2many('ir.module.module', compute='_compute_uninstalled_l10n_module_ids')
_sql_constraints = [
('name_uniq', 'unique (name)', 'The company name must be unique!')
Expand Down Expand Up @@ -220,9 +221,6 @@ def _compute_uninstalled_l10n_module_ids(self):
for company in self:
company.uninstalled_l10n_module_ids = self.env['ir.module.module'].browse(mapping.get(company.country_id.id))

def install_l10n_modules(self):
return self.uninstalled_l10n_module_ids.button_immediate_install()

@api.model
def _get_view(self, view_id=None, view_type='form', **options):
delegated_fnames = set(self._get_company_root_delegated_field_names())
Expand Down
9 changes: 0 additions & 9 deletions odoo/addons/base/views/res_company_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,6 @@
<field name="arch" type="xml">
<form string="Company" duplicate="0">
<field name="all_child_ids" invisible="1"/>
<field name="uninstalled_l10n_module_ids" invisible="1"/>

<div class="alert alert-info" role="alert" invisible="not uninstalled_l10n_module_ids">
Localization features are available for this country:
<button name="install_l10n_modules"
type="object"
string="Install"
class="btn btn-link p-0 align-baseline"/>
</div>
<sheet>
<div class="oe_button_box" name="button_box">
<button class="oe_stat_button"
Expand Down

0 comments on commit a2a3e1b

Please sign in to comment.