first commit
This commit is contained in:
commit
d0af9f97b2
1
contact_customized/__init__.py
Executable file
1
contact_customized/__init__.py
Executable file
@ -0,0 +1 @@
|
||||
import models
|
19
contact_customized/__manifest__.py
Executable file
19
contact_customized/__manifest__.py
Executable file
@ -0,0 +1,19 @@
|
||||
{
|
||||
'name':'Customized Contact',
|
||||
'version': '1.0',
|
||||
'author': 'Youssef ELOUAHBY',
|
||||
'website': 'http://www.test.ye',
|
||||
'sequence': 2,
|
||||
'category': 'Tools',
|
||||
'summary': 'Customers, Vendors, Partners,...',
|
||||
'description': """
|
||||
This module allows customization of contacts
|
||||
""",
|
||||
'depends': ['base','contacts'],
|
||||
'data': ['views/contact.xml',
|
||||
'views/type.xml'
|
||||
],
|
||||
'installable': True,
|
||||
'application': True,
|
||||
'auto_install': False,
|
||||
}
|
123
contact_customized/i18n/fr.po
Executable file
123
contact_customized/i18n/fr.po
Executable file
@ -0,0 +1,123 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * contact_customized
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 10.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2018-01-13 17:58+0000\n"
|
||||
"PO-Revision-Date: 2018-01-13 17:58+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: contact_customized
|
||||
#: model:ir.model.fields,field_description:contact_customized.field_contact_type_Actif
|
||||
msgid "Active"
|
||||
msgstr "Actif"
|
||||
|
||||
#. module: contact_customized
|
||||
#: model:ir.ui.view,arch_db:contact_customized.view_contact_calendar
|
||||
msgid "Calendar"
|
||||
msgstr "Calendrier"
|
||||
|
||||
#. module: contact_customized
|
||||
#: model:ir.ui.menu,name:contact_customized.configuration_type_contact
|
||||
msgid "Configuration"
|
||||
msgstr "Configuration"
|
||||
|
||||
#. module: contact_customized
|
||||
#: model:ir.actions.act_window,name:contact_customized.contact_type_action
|
||||
#: model:ir.ui.menu,name:contact_customized.typecontact_menu
|
||||
msgid "Contact Type"
|
||||
msgstr "Contact Type"
|
||||
|
||||
#. module: contact_customized
|
||||
#: model:ir.model.fields,field_description:contact_customized.field_res_partner_type_id
|
||||
#: model:ir.model.fields,field_description:contact_customized.field_res_users_type_id
|
||||
msgid "Contact type"
|
||||
msgstr "Type de contact"
|
||||
|
||||
#. module: contact_customized
|
||||
#: model:ir.ui.view,arch_db:contact_customized.view_contact_pivot
|
||||
msgid "Contacts"
|
||||
msgstr "Contacts"
|
||||
|
||||
#. module: contact_customized
|
||||
#: model:ir.model.fields,field_description:contact_customized.field_contact_type_create_uid
|
||||
msgid "Created by"
|
||||
msgstr "Créé par"
|
||||
|
||||
#. module: contact_customized
|
||||
#: model:ir.model.fields,field_description:contact_customized.field_contact_type_create_date
|
||||
msgid "Created on"
|
||||
msgstr "Créé le"
|
||||
|
||||
|
||||
#. module: contact_customized
|
||||
#: model:ir.model.fields,field_description:contact_customized.field_res_partner_dateOfFirstContact
|
||||
#: model:ir.model.fields,field_description:contact_customized.field_res_users_dateOfFirstContact
|
||||
msgid "Date of first contact"
|
||||
msgstr "Date du 1er contact"
|
||||
|
||||
#. module: contact_customized
|
||||
#: model:ir.model.fields,field_description:contact_customized.field_contact_type_display_name
|
||||
msgid "Display Name"
|
||||
msgstr "Nom affiché"
|
||||
|
||||
#. module: contact_customized
|
||||
#: model:ir.model.fields,field_description:contact_customized.field_res_partner_fullAddress
|
||||
#: model:ir.model.fields,field_description:contact_customized.field_res_users_fullAddress
|
||||
msgid "Full address"
|
||||
msgstr "Adresse complète"
|
||||
|
||||
#. module: contact_customized
|
||||
#: model:ir.model.fields,field_description:contact_customized.field_contact_type_id
|
||||
msgid "ID"
|
||||
msgstr "ID"
|
||||
|
||||
#. module: contact_customized
|
||||
#: model:ir.model.fields,field_description:contact_customized.field_res_partner_isVip
|
||||
#: model:ir.model.fields,field_description:contact_customized.field_res_users_isVip
|
||||
msgid "Is VIP"
|
||||
msgstr "Contact privilégié"
|
||||
|
||||
#. module: contact_customized
|
||||
#: model:ir.model.fields,field_description:contact_customized.field_contact_type___last_update
|
||||
msgid "Last Modified on"
|
||||
msgstr "Dernière Modification le"
|
||||
|
||||
#. module: contact_customized
|
||||
#: model:ir.model.fields,field_description:contact_customized.field_contact_type_write_uid
|
||||
msgid "Last Updated by"
|
||||
msgstr "Dernière mise à jour par"
|
||||
|
||||
#. module: contact_customized
|
||||
#: model:ir.model.fields,field_description:contact_customized.field_contact_type_write_date
|
||||
msgid "Last Updated on"
|
||||
msgstr "Dernière mise à jour le"
|
||||
|
||||
#. module: contact_customized
|
||||
#: model:ir.model,name:contact_customized.model_res_partner
|
||||
msgid "Partner"
|
||||
msgstr "Partenaire"
|
||||
|
||||
#. module: contact_customized
|
||||
#: model:ir.model.fields,field_description:contact_customized.field_contact_type_name
|
||||
msgid "Type"
|
||||
msgstr "Type"
|
||||
|
||||
#. module: contact_customized
|
||||
#: sql_constraint:contact.type:0
|
||||
msgid "Type must be unique!"
|
||||
msgstr "Type must be unique!"
|
||||
|
||||
#. module: contact_customized
|
||||
#: model:ir.ui.view,arch_db:contact_customized.view_partner_search_persocontact_inherited
|
||||
msgid "VIP"
|
||||
msgstr "VIP"
|
||||
|
3
contact_customized/models/__init__.py
Executable file
3
contact_customized/models/__init__.py
Executable file
@ -0,0 +1,3 @@
|
||||
import type
|
||||
|
||||
|
BIN
contact_customized/models/__init__.pyc
Executable file
BIN
contact_customized/models/__init__.pyc
Executable file
Binary file not shown.
55
contact_customized/models/type.py
Executable file
55
contact_customized/models/type.py
Executable file
@ -0,0 +1,55 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from odoo import api, fields, models, _
|
||||
from datetime import datetime
|
||||
from odoo.exceptions import Warning
|
||||
|
||||
|
||||
#class contact.type qui permet de stocker le type du contact et s'il est actif
|
||||
class contactType(models.Model):
|
||||
_name = 'contact.type'
|
||||
|
||||
|
||||
_description ="Daily Transaction"
|
||||
|
||||
name = fields.Char(string='Type', size=128, required=True, translate=True)
|
||||
Actif=fields.Boolean('Active', default=True, translate=True)
|
||||
|
||||
_sql_constraints = [
|
||||
('name', 'unique(name)',
|
||||
'Type must be unique!'),
|
||||
]
|
||||
|
||||
#class heristé du class res.partner pour l'ajout des nouveaux champs au contact
|
||||
class contactPerso(models.Model):
|
||||
_inherit = "res.partner"
|
||||
_order="dateOfFirstContact desc"
|
||||
|
||||
fullAddress = fields.Char(string="Full address",size =300, compute="get_adress", translate=True)
|
||||
isVip = fields.Boolean(string="Is VIP",default=False, translate=True)
|
||||
dateOfFirstContact = fields.Date(string="Date of first contact", default=fields.Date.today, translate=True)
|
||||
type_id= fields.Many2one('contact.type', string="Contact type", required=True, translate=True)
|
||||
|
||||
#Calcul champs Addresse complete
|
||||
|
||||
@api.one
|
||||
@api.depends('street','street2','city','zip')
|
||||
def get_adress(self):
|
||||
fullAddress =" "
|
||||
if self.street :
|
||||
fullAddress += self.street +' '
|
||||
if self.street2:
|
||||
fullAddress += self.street2+' '
|
||||
if self.city:
|
||||
fullAddress += self.city +' '
|
||||
if self.zip:
|
||||
fullAddress += self.zip
|
||||
self.fullAddress = fullAddress
|
||||
|
||||
#Validation de la date pour empecher qu'elle soit apres la date courante
|
||||
|
||||
@api.constrains('dateOfFirstContact')
|
||||
def constFirstContact(self):
|
||||
current_date = datetime.now().date()
|
||||
dateOfFirstContact = fields.Datetime.from_string(self.dateOfFirstContact).date()
|
||||
if dateOfFirstContact > current_date:
|
||||
raise Warning('Invalid Date!')
|
BIN
contact_customized/models/type.pyc
Executable file
BIN
contact_customized/models/type.pyc
Executable file
Binary file not shown.
101
contact_customized/views/contact.xml
Executable file
101
contact_customized/views/contact.xml
Executable file
@ -0,0 +1,101 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
|
||||
<!--modification du vue formulaire -->
|
||||
<record id="view_partner_form_persocontact_inherited" model="ir.ui.view">
|
||||
<field name="name">base.view_partner_form.perso.inherited</field>
|
||||
<field name="model">res.partner</field>
|
||||
<field name="inherit_id" ref="base.view_partner_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='website']" position="after">
|
||||
<field name="isVip"/>
|
||||
<field name="dateOfFirstContact"/>
|
||||
<field name="fullAddress"/>
|
||||
<field name="type_id" attrs="{'invisible':[('is_company','=', True)] , 'required' : [('isVip', '=', True)]}" widget="selection" domain="[('Actif','=',True)]"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!--modification du vue tree-->
|
||||
<record id="view_partner_tree_persocontact_inherited" model="ir.ui.view">
|
||||
<field name="name">base.tree.perso.inherited</field>
|
||||
<field name="model">res.partner</field>
|
||||
<field name="inherit_id" ref="base.view_partner_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="email" position="after">
|
||||
<field name="dateOfFirstContact"/>
|
||||
<field name="type_id"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!--modification du vue search-->
|
||||
<record id="view_partner_search_persocontact_inherited" model="ir.ui.view">
|
||||
<field name="name">base.srch.perso.inherited</field>
|
||||
<field name="model">res.partner</field>
|
||||
<field name="inherit_id" ref="base.view_res_partner_filter"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="name" position="after">
|
||||
<field name="type_id"/>
|
||||
</field>
|
||||
<filter name="customer" position="after">
|
||||
<filter string="VIP" name="vip" domain="[('isVip','=',1)]"/>
|
||||
</filter>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!--modificationvue Kanban-->
|
||||
<record id="view_partner_kanban_persocontact_inherited" model="ir.ui.view">
|
||||
<field name="name">base.kanban.perso.inherited</field>
|
||||
<field name="model">res.partner</field>
|
||||
<field name="inherit_id" ref="base.res_partner_kanban_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="display_name" position="after">
|
||||
<field name="dateOfFirstContact"/>
|
||||
<field name="type_id"/>
|
||||
</field>
|
||||
<xpath expr="//div[@class='oe_kanban_details']/ul" position="inside">
|
||||
<li t-if="record.type_id.raw_value"><field name="type_id"/>, <field name="country_id"/></li>
|
||||
<li t-if="record.dateOfFirstContact.raw_value"><field name="dateOfFirstContact"/></li>
|
||||
|
||||
</xpath>
|
||||
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!--vue Calendrier-->
|
||||
<record id="view_contact_calendar" model="ir.ui.view">
|
||||
<field name="name">partner.calendar</field>
|
||||
<field name="model">res.partner</field>
|
||||
<field name="priority" eval="2"/>
|
||||
<field name="arch" type="xml">
|
||||
<calendar string="Calendar" date_start="dateOfFirstContact" date_stop="dateOfFirstContact"
|
||||
readonly_form_view_id="%(view_partner_form_persocontact_inherited)s"
|
||||
event_open_popup="false"
|
||||
color="name">
|
||||
<field name="name"/>
|
||||
</calendar>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!--vue pivot-->
|
||||
<record id="view_contact_pivot" model="ir.ui.view">
|
||||
<field name="name">partner.pivot</field>
|
||||
<field name="model">res.partner</field>
|
||||
<field name="arch" type="xml">
|
||||
<pivot string="Contacts">
|
||||
<field name="name" type="row"/>
|
||||
<field name="type" type="row"/>
|
||||
<field name="dateOfFirstContact" type="row"/>
|
||||
</pivot>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="contacts.action_contacts" model="ir.actions.act_window">
|
||||
<field name="view_mode">kanban,tree,calendar,pivot,graph,form</field>
|
||||
</record>
|
||||
|
||||
|
||||
</data>
|
||||
</odoo>
|
46
contact_customized/views/type.xml
Executable file
46
contact_customized/views/type.xml
Executable file
@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
|
||||
<!-- Search type de contact-->
|
||||
<record model="ir.ui.view" id="course_search_view">
|
||||
<field name="name">contact search</field>
|
||||
<field name="model">contact.type</field>
|
||||
<field name="arch" type="xml">
|
||||
<search>
|
||||
<field name="name"/>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<!-- Tree type de contact-->
|
||||
<record model="ir.ui.view" id="course_tree_view">
|
||||
<field name="name">contact tree</field>
|
||||
<field name="model">contact.type</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree editable="bottom">
|
||||
<field name="name"/>
|
||||
<field name="Actif"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Action a declencher en cas du clique sur contact type-->
|
||||
<record model="ir.actions.act_window" id="contact_type_action">
|
||||
<field name="name">Contact Type</field>
|
||||
<field name="res_model">contact.type</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
|
||||
|
||||
<!-- sous menu appartenant au menu contacts du module contacts-->
|
||||
<menuitem id="configuration_type_contact" name="Configuration"
|
||||
parent="contacts.menu_contacts"/>
|
||||
<!-- element contact type pour afficher/ajouter/modifier le type du contact-->
|
||||
<menuitem id="typecontact_menu" name="Contact Type" parent="configuration_type_contact"
|
||||
action="contact_type_action"/>
|
||||
|
||||
</data>
|
||||
</odoo>
|
0
sample_addon/__init__.py
Normal file
0
sample_addon/__init__.py
Normal file
29
sample_addon/__manifest__.py
Normal file
29
sample_addon/__manifest__.py
Normal file
@ -0,0 +1,29 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2017 Firstname Lastname <firstname.lastname@company.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
{
|
||||
'name': 'Sample module',
|
||||
'summary': 'Sample module that does nothing',
|
||||
'description': """ Sample module that does nothing """,
|
||||
'version': '10.0.0.0.1',
|
||||
'category': 'Useless',
|
||||
'author': 'Firstname Lastname',
|
||||
'license': 'AGPL-3',
|
||||
'application': False,
|
||||
'installable': True,
|
||||
'depends': ['base']
|
||||
}
|
Loading…
Reference in New Issue
Block a user