Skip to content
Snippets Groups Projects
Commit 3b4caa31 authored by jordan's avatar jordan
Browse files

[add] fields for "commerce"

parent bb98761a
Branches
No related tags found
No related merge requests found
......@@ -27,6 +27,10 @@ class ModelName(models.Model):
business_name = fields.Char(
string='Raison Sociale',
required=False)
region_id = fields.Many2one(
comodel_name='res.country.state',
string='Région',
required=False)
facebook = fields.Char(
string='Facebook',
......@@ -56,6 +60,9 @@ class ModelName(models.Model):
comodel_name='res.partner.commerce.status',
string='Statut du commerce',
required=False)
related_commerce_status = fields.Many2one(
string='Statut du commerce affiché',
related='commerce_status_id')
gt_commerce_participation = fields.Boolean(
string='Participe au GT Commerce',
required=False)
......@@ -153,10 +160,6 @@ class ModelName(models.Model):
# ------------------------------------------------------
# Onchange / Constraints
# ------------------------------------------------------
@api.onchange('company_type')
def onchange_company_type(self):
self.type_id = None
@api.onchange('type_id')
def onchange_type(self):
self.subtype_id = None
......@@ -4,13 +4,22 @@
<odoo>
<data>
<record id="ModelName_form_inherit" model="ir.ui.view">
<record id="res_partner_form_inherit" model="ir.ui.view">
<field name="name">res.partner.form</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="priority" eval="8"/>
<field name="arch" type="xml">
<xpath expr="//sheet" position="before">
<header>
<field name="related_commerce_status" widget="statusbar" clickable="0"
attrs="{'invisible': [('type_id', 'not in', (%(etic_partner.type_shop)d, %(etic_partner.type_supplier)d))]}"/>
</header>
</xpath>
<xpath expr="//group[1]" position="before">
<group col="2">
<group>
<field name="type_id" options="{'no_open': True, 'no_create': True}"
domain="[('partner_type', 'in', [company_type, 'all'])]"/>
......@@ -18,7 +27,38 @@
domain="[('parent_type_id', '=', type_id)]"
attrs="{'invisible': [('company_type', '=', 'person')]}"/>
</group>
<group>
<field name="meg" attrs="{'invisible': [('company_type', '=', 'person')]}"/>
</group>
</group>
</xpath>
<xpath expr="//field[@name='country_id']" position="after">
<field name="region_id" placeholder="Région" class="o_address_country" options='{"no_open": True}'
attrs="{'readonly': [('type', '=', 'contact'),('parent_id', '!=', False)]}"
domain="[('country_id', '=', country_id)]"/>
</xpath>
<xpath expr="//field[@name='function']" position="attributes">
<attribute name="string">Fonction</attribute>
<attribute name="attrs">{'invisible': [('company_type', '!=', 'person')]}</attribute>
</xpath>
<xpath expr="//field[@name='function']" position="after">
<field name="service" attrs="{'invisible': [('company_type', '!=', 'person')]}"/>
</xpath>
<xpath expr="//page[@name='sales_purchases']" position="after">
<page name='commerce' string="Commerce"
attrs="{'invisible': [('type_id', 'not in', (%(etic_partner.type_shop)d, %(etic_partner.type_supplier)d))]}">
<group>
<field name="commerce_type_id" options="{'no_open': True, 'no_create': True}"/>
<field name="legal_status_id" options="{'no_open': True, 'no_create': True}"/>
<field name="commerce_status_id" options="{'no_open': True, 'no_create': True}"/>
<field name="gt_commerce_participation" widget="boolean_toggle"/>
</group>
</page>
</xpath>
</field>
</record>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment