Browse Source

modification fiche contact

master
root 3 years ago
parent
commit
445103cc6c
2 changed files with 101 additions and 46 deletions
  1. +44
    -27
      models/partner.py
  2. +57
    -19
      views/partner.xml

+ 44
- 27
models/partner.py View File

@ -9,7 +9,24 @@ from string import ascii_uppercase
class partner(models.Model): class partner(models.Model):
_inherit = 'res.partner' _inherit = 'res.partner'
type = fields.Selection(
[('contact', 'Contact'),
('invoice', 'Invoice Address'),
('delivery', 'Delivery Address'),
('other', 'Other Address'),
("private", "Private Address"),
], string='Address Type',
default='private',
help="Invoice & Delivery addresses are used in sales orders. Private addresses are only visible by authorized users.")
locality=fields.Char('Locality')
tax_street=fields.Char('Street')
tax_street2=fields.Char('Street2')
tax_locality=fields.Char('Locality')
tax_city=fields.Char('City')
tax_zip=fields.Char('Zip ')
tax_country_id=fields.Many2one('res.country')
def _compute_address_count(self): def _compute_address_count(self):
# The current user may not have access rights for donations # The current user may not have access rights for donations
for partner in self: for partner in self:
@ -129,32 +146,32 @@ class partner(models.Model):
def _alpha(self,id): def _alpha(self,id):
alpha={} alpha={}
alpha[1]='A'
alpha[2]='B'
alpha[3]='C'
alpha[4]='D'
alpha[5]='E'
alpha[6]='F'
alpha[7]='G'
alpha[8]='H'
alpha[9]='I'
alpha[10]='J'
alpha[11]='K'
alpha[12]='L'
alpha[13]='M'
alpha[14]='N'
alpha[15]='O'
alpha[16]='P'
alpha[17]='Q'
alpha[18]='R'
alpha[19]='S'
alpha[20]='T'
alpha[21]='U'
alpha[22]='V'
alpha[23]='W'
alpha[24]='X'
alpha[25]='Y'
alpha[26]='Z'
alpha[0]='A'
alpha[1]='B'
alpha[2]='C'
alpha[3]='D'
alpha[4]='E'
alpha[5]='F'
alpha[6]='G'
alpha[7]='H'
alpha[8]='I'
alpha[9]='J'
alpha[10]='K'
alpha[11]='L'
alpha[12]='M'
alpha[13]='N'
alpha[14]='O'
alpha[15]='P'
alpha[16]='Q'
alpha[17]='R'
alpha[18]='S'
alpha[19]='T'
alpha[20]='U'
alpha[21]='V'
alpha[22]='W'
alpha[23]='X'
alpha[24]='Y'
alpha[25]='Z'
return (alpha[id%26]) return (alpha[id%26])
def _compute_key(self): def _compute_key(self):


+ 57
- 19
views/partner.xml View File

@ -2,6 +2,23 @@
<odoo> <odoo>
<record id="contacts.action_contacts" model="ir.actions.act_window">
<field name="name">Contacts</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">res.partner</field>
<field name="view_mode">kanban,tree,form,activity</field>
<field name="search_view_id" ref="base.view_res_partner_filter"/>
<field name="context">{'default_is_company': False,'type':'private'}</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create a contact in your address book
</p><p>
Odoo helps you to easily track all activities related to a customer.
</p>
</field>
</record>
<record id="act_partner_text_qualifier" model="ir.actions.act_window"> <record id="act_partner_text_qualifier" model="ir.actions.act_window">
<field name="name">Text qualifiers</field> <field name="name">Text qualifiers</field>
<field name="res_model">opendons_qualifier.partnerqualifier</field> <field name="res_model">opendons_qualifier.partnerqualifier</field>
@ -70,12 +87,36 @@
<field name="inherit_id" ref="base.view_partner_form" /> <field name="inherit_id" ref="base.view_partner_form" />
<field name="arch" type="xml"> <field name="arch" type="xml">
<xpath expr="//field[@name='city']" position="before">
<field name="locality" string="Locality" placeholder="locality"/>
</xpath>
<xpath expr="//page[@name='sales_purchases']" position="before">
<page name="tax_address" string="Tax address">
<group col="12">
<group colspan="5">
<div class="o_address_format">
<field name="tax_street" placeholder="Street..." class="o_address_street" />
<field name="tax_street2" placeholder="Street 2..." class="o_address_street"/>
<field name="tax_locality" placeholder="Locality" class="o_address_street"/>
<field name="tax_city" placeholder="City" class="o_address_city" />
<field name="tax_zip" placeholder="ZIP" class="o_address_zip"/>
<field name="tax_country_id" placeholder="Country" class="o_address_country" options="{&quot;no_open&quot;: True, &quot;no_create&quot;: True}"/>
</div>
</group>
</group>
</page>
</xpath>
<xpath expr="/form/sheet/div/h1" position="replace"> <xpath expr="/form/sheet/div/h1" position="replace">
<group> <group>
<group> <group>
<field id="company" class="o_text_overflow" name="name" default_focus="1" placeholder="e.g. Lumber Inc" attrs="{'required' : [('type', '=', 'contact'),('is_company', '=', True)], 'invisible': [('is_company','=', False)]}"/> <field id="company" class="o_text_overflow" name="name" default_focus="1" placeholder="e.g. Lumber Inc" attrs="{'required' : [('type', '=', 'contact'),('is_company', '=', True)], 'invisible': [('is_company','=', False)]}"/>
<field id="individual" class="o_text_overflow" name="name" default_focus="1" placeholder="e.g. Brandom Freeman" attrs="{'required' : [('type', '=', 'contact'), ('is_company', '=', False)], 'invisible': [('is_company','=', True)]}"/> <field id="individual" class="o_text_overflow" name="name" default_focus="1" placeholder="e.g. Brandom Freeman" attrs="{'required' : [('type', '=', 'contact'), ('is_company', '=', False)], 'invisible': [('is_company','=', True)]}"/>
<field name="firstname" attrs="{'invisible':[('is_company','=',True)]}"/> <field name="firstname" attrs="{'invisible':[('is_company','=',True)]}"/>
<field name="title" options="{&quot;no_open&quot;: True}" placeholder="e.g. Mister" attrs="{'invisible': [('is_company', '=', True)]}"/>
<field name="id"/> <field name="id"/>
<field name="key"/> <field name="key"/>
<field name="source"/> <field name="source"/>
@ -98,26 +139,10 @@
<xpath expr="/form/sheet/div/div" position="replace"> <xpath expr="/form/sheet/div/div" position="replace">
</xpath> </xpath>
<!-- <xpath expr="//label[@for='phone']" position="replace"></xpath>
<xpath expr="//field[@name='phone']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//label[@for='mobile']" position="replace"></xpath>
<xpath expr="//field[@name='mobile']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//label[@for='email']" position="replace"></xpath>
<xpath expr="//field[@name='email']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath> -->
<!-- <xpath expr="//page[@name='contact_addresses']" position="replace">
</xpath> -->
<xpath expr="//span[@name='address_name']" position="before">
<xpath expr="//field[@name='type']" position="before">
<field name="npai_count"/> <field name="npai_count"/>
</xpath> </xpath>
<!-- <xpath expr="//field[@name='state_id']" position="replace">
</xpath> -->
<xpath expr="//div[@name='button_box']" position="inside"> <xpath expr="//div[@name='button_box']" position="inside">
<button class="oe_stat_button" type="action" <button class="oe_stat_button" type="action"
name="%(act_partner_recurring_donation)d" name="%(act_partner_recurring_donation)d"
@ -165,7 +190,20 @@
</button> </button>
</xpath> </xpath>
<xpath expr="//field[@name='state_id']" position="attributes">
<attribute name="invisible">True</attribute>
</xpath>
<xpath expr="//field[@name='vat']" position="attributes">
<attribute name="invisible">True</attribute>
</xpath>
<xpath expr="/form/sheet/group/group[2]/field[@name='title']" position="attributes">
<attribute name="invisible">True</attribute>
</xpath>
<xpath expr="//page[@name='contact_addresses']" position="replace">
</xpath>
</field> </field>
</record> </record>


Loading…
Cancel
Save