Browse Source

Use config page instead of company form view

pull/132/head
Alexis de Lattre 8 years ago
parent
commit
6d2de57912
  1. 4
      base_phone/__manifest__.py
  2. 1
      base_phone/models/__init__.py
  3. 12
      base_phone/models/base_config_settings.py
  4. 27
      base_phone/views/base_config_settings.xml
  5. 25
      base_phone/views/res_company_view.xml

4
base_phone/__manifest__.py

@ -28,13 +28,13 @@
'summary': 'Validate phone numbers', 'summary': 'Validate phone numbers',
'author': "Akretion,Odoo Community Association (OCA)", 'author': "Akretion,Odoo Community Association (OCA)",
'website': 'http://www.akretion.com/', 'website': 'http://www.akretion.com/',
'depends': ['base', 'web'],
'depends': ['base_setup', 'web'],
'external_dependencies': {'python': ['phonenumbers']}, 'external_dependencies': {'python': ['phonenumbers']},
'data': [ 'data': [
'security/phone_security.xml', 'security/phone_security.xml',
'security/ir.model.access.csv', 'security/ir.model.access.csv',
'views/res_partner_view.xml', 'views/res_partner_view.xml',
'views/res_company_view.xml',
'views/base_config_settings.xml',
'views/res_users_view.xml', 'views/res_users_view.xml',
'wizard/reformat_all_phonenumbers_view.xml', 'wizard/reformat_all_phonenumbers_view.xml',
'wizard/number_not_found_view.xml', 'wizard/number_not_found_view.xml',

1
base_phone/models/__init__.py

@ -2,6 +2,7 @@
from . import base from . import base
from . import res_company from . import res_company
from . import base_config_settings
from . import res_partner from . import res_partner
from . import phone_common from . import phone_common
from . import ir_fields_converter from . import ir_fields_converter

12
base_phone/models/base_config_settings.py

@ -0,0 +1,12 @@
# -*- coding: utf-8 -*-
# © 2017 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models, fields
class BaseConfigSettings(models.TransientModel):
_inherit = 'base.config.settings'
number_of_digits_to_match_from_end = fields.Integer(
related='company_id.number_of_digits_to_match_from_end')

27
base_phone/views/base_config_settings.xml

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
© 2014-2017 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>
<record id="view_general_configuration" model="ir.ui.view">
<field name="name">base_phone.base.config.settings.form</field>
<field name="model">base.config.settings</field>
<field name="inherit_id" ref="base_setup.view_general_configuration" />
<field name="arch" type="xml">
<group name="report" position="before">
<group name="phone" string="Phone">
<label for="number_of_digits_to_match_from_end"/>
<div>
<field name="number_of_digits_to_match_from_end" class="oe_inline"/>
</div>
</group>
</group>
</field>
</record>
</odoo>

25
base_phone/views/res_company_view.xml

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
© 2014-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>
<record id="view_company_form" model="ir.ui.view">
<field name="name">base_phone.company.form</field>
<field name="model">res.company</field>
<field name="inherit_id" ref="base.view_company_form" />
<field name="arch" type="xml">
<xpath expr="//notebook" position="inside">
<page string="Phone">
<group name="phone" string="Phone">
<field name="number_of_digits_to_match_from_end" />
</group>
</page>
</xpath>
</field>
</record>
</odoo>
Loading…
Cancel
Save