diff options
| author | Yannick Tivisse <yti@odoo.com> | 2016-04-05 10:20:04 +0200 |
|---|---|---|
| committer | Yannick Tivisse <yti@odoo.com> | 2016-04-08 11:13:56 +0200 |
| commit | e4ae6a80bb2d95a85d222d9012282919d5ebac0f (patch) | |
| tree | 1ca95863bfbc9100e8f0e340be43c20061e3d915 | |
| parent | 970ac1e1299d9de4988a4bc433eb19a593288a1f (diff) | |
[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.
| -rw-r--r-- | openerp/addons/base/res/res_company.py | 3 | ||||
| -rw-r--r-- | openerp/addons/base/res/res_company_view.xml | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/openerp/addons/base/res/res_company.py b/openerp/addons/base/res/res_company.py index cf8dcf00ff2..d92cc25b87d 100644 --- a/openerp/addons/base/res/res_company.py +++ b/openerp/addons/base/res/res_company.py @@ -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 !') diff --git a/openerp/addons/base/res/res_company_view.xml b/openerp/addons/base/res/res_company_view.xml index 763b22d2218..14e1244b820 100644 --- a/openerp/addons/base/res/res_company_view.xml +++ b/openerp/addons/base/res/res_company_view.xml @@ -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> |
