[IMP] base: order companies in Company Switcher
Add a sequence field on the res_company. The companies are ordered by sequence (by default 10), than by name. That way, we can order the companies on the company switcher for example, and have the most common companies first.
This commit is contained in:
@@ -11,7 +11,7 @@ from odoo.exceptions import ValidationError
|
||||
class Company(models.Model):
|
||||
_name = "res.company"
|
||||
_description = 'Companies'
|
||||
_order = 'name'
|
||||
_order = 'sequence, name'
|
||||
|
||||
_header = """
|
||||
<header>
|
||||
@@ -152,6 +152,7 @@ class Company(models.Model):
|
||||
vat = fields.Char(related='partner_id.vat', string="Tax ID")
|
||||
company_registry = fields.Char()
|
||||
rml_paper_format = fields.Selection([('a4', 'A4'), ('us_letter', 'US Letter')], string="Paper Format", required=True, default='a4', oldname='paper_format')
|
||||
sequence = fields.Integer(help='Used to order Companies in the company switcher', default=10)
|
||||
|
||||
_sql_constraints = [
|
||||
('name_uniq', 'unique (name)', 'The company name must be unique !')
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
<field name="company_registry"/>
|
||||
<field name="currency_id" options="{'no_create': True}" id="company_currency"/>
|
||||
<field name="parent_id" groups="base.group_multi_company"/>
|
||||
<field name="sequence" invisible="1"/>
|
||||
</group>
|
||||
</group>
|
||||
</page>
|
||||
@@ -88,6 +89,7 @@
|
||||
<field name="field_parent">child_ids</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Companies">
|
||||
<field name="sequence" widget="handle"/>
|
||||
<field name="name"/>
|
||||
<field name="partner_id"/>
|
||||
</tree>
|
||||
|
||||
Reference in New Issue
Block a user