Merge branch '10.0' of https://github.com/akretion/odoo-usability into 10.0
This commit is contained in:
23
base_partner_one2many_phone/__init__.py
Normal file
23
base_partner_one2many_phone/__init__.py
Normal file
@@ -0,0 +1,23 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Base Partner One2many Phone module for OpenERP
|
||||
# Copyright (C) 2014 Artisanat Monastique de Provence
|
||||
# (http://www.barroux.org)
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from . import partner_phone
|
||||
30
base_partner_one2many_phone/__manifest__.py
Normal file
30
base_partner_one2many_phone/__manifest__.py
Normal file
@@ -0,0 +1,30 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# © 2014-2016 Abbaye du Barroux (http://www.barroux.org)
|
||||
# © 2016 Akretion (http://www.akretion.com>)
|
||||
# @author: Frère Bernard <informatique@barroux.org>
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
{
|
||||
'name': 'Base Partner One2many Phone',
|
||||
'version': '0.1',
|
||||
'category': 'Phone',
|
||||
'license': 'AGPL-3',
|
||||
'summary': 'One2many link between partners and phone numbers',
|
||||
'description': """
|
||||
Base Partner One2many Phone
|
||||
===========================
|
||||
|
||||
With this module, one partner can have N phone numbers. It adds a new table dedicated to phone numbers and a one2many link between partners and phone numbers.
|
||||
|
||||
It has been developped by brother Bernard from Barroux Abbey and Alexis de Lattre from Akretion.
|
||||
""",
|
||||
'author': 'Barroux',
|
||||
'website': 'http://www.barroux.org',
|
||||
'depends': ['base_phone'],
|
||||
'data': [
|
||||
'partner_phone_view.xml',
|
||||
'security/ir.model.access.csv',
|
||||
],
|
||||
'active': True,
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
# Translation of OpenERP Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * base_partner_one2many_phone
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: OpenERP Server 8.0alpha1\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2014-07-02 13:35+0000\n"
|
||||
"PO-Revision-Date: 2014-07-02 13:35+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: base_partner_one2many_phone
|
||||
#: selection:res.partner.phone,type:0
|
||||
msgid "Home"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_partner_one2many_phone
|
||||
#: selection:res.partner.phone,type:0
|
||||
msgid "Home Fax"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_partner_one2many_phone
|
||||
#: selection:res.partner.phone,type:0
|
||||
msgid "Mobile"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_partner_one2many_phone
|
||||
#: field:res.partner.phone,note:0
|
||||
msgid "Note"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_partner_one2many_phone
|
||||
#: selection:res.partner.phone,type:0
|
||||
msgid "Office"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_partner_one2many_phone
|
||||
#: selection:res.partner.phone,type:0
|
||||
msgid "Office Fax"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_partner_one2many_phone
|
||||
#: selection:res.partner.phone,type:0
|
||||
msgid "Other"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_partner_one2many_phone
|
||||
#: model:ir.model,name:base_partner_one2many_phone.model_res_partner
|
||||
msgid "Partner"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_partner_one2many_phone
|
||||
#: field:res.partner.phone,phone:0
|
||||
msgid "Phone"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_partner_one2many_phone
|
||||
#: field:res.partner.phone,type:0
|
||||
msgid "Phone Type"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_partner_one2many_phone
|
||||
#: selection:res.partner.phone,type:0
|
||||
msgid "Phone/fax Home"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_partner_one2many_phone
|
||||
#: model:ir.actions.act_window,name:base_partner_one2many_phone.res_partner_phone_action
|
||||
#: model:ir.ui.menu,name:base_partner_one2many_phone.res_partner_phone_menu
|
||||
#: field:res.partner,phone_ids:0
|
||||
#: view:res.partner.phone:0
|
||||
msgid "Phones"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_partner_one2many_phone
|
||||
#: field:res.partner.phone,partner_id:0
|
||||
msgid "Related Partner"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_partner_one2many_phone
|
||||
#: model:ir.model,name:base_partner_one2many_phone.model_res_partner_phone
|
||||
msgid "res.partner.phone"
|
||||
msgstr ""
|
||||
|
||||
89
base_partner_one2many_phone/i18n/fr.po
Normal file
89
base_partner_one2many_phone/i18n/fr.po
Normal file
@@ -0,0 +1,89 @@
|
||||
# Translation of OpenERP Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * base_partner_one2many_phone
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: OpenERP Server 8.0alpha1\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2014-07-02 13:37+0000\n"
|
||||
"PO-Revision-Date: 2014-07-02 15:50+0100\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: \n"
|
||||
"X-Generator: Poedit 1.5.7\n"
|
||||
|
||||
#. module: base_partner_one2many_phone
|
||||
#: selection:res.partner.phone,type:0
|
||||
msgid "Home"
|
||||
msgstr "Domicile"
|
||||
|
||||
#. module: base_partner_one2many_phone
|
||||
#: selection:res.partner.phone,type:0
|
||||
msgid "Home Fax"
|
||||
msgstr "Fax domicile"
|
||||
|
||||
#. module: base_partner_one2many_phone
|
||||
#: selection:res.partner.phone,type:0
|
||||
msgid "Mobile"
|
||||
msgstr "Mobile"
|
||||
|
||||
#. module: base_partner_one2many_phone
|
||||
#: field:res.partner.phone,note:0
|
||||
msgid "Note"
|
||||
msgstr "Note"
|
||||
|
||||
#. module: base_partner_one2many_phone
|
||||
#: selection:res.partner.phone,type:0
|
||||
msgid "Office"
|
||||
msgstr "Bureau"
|
||||
|
||||
#. module: base_partner_one2many_phone
|
||||
#: selection:res.partner.phone,type:0
|
||||
msgid "Office Fax"
|
||||
msgstr "Fax bureau"
|
||||
|
||||
#. module: base_partner_one2many_phone
|
||||
#: selection:res.partner.phone,type:0
|
||||
msgid "Other"
|
||||
msgstr "Autre"
|
||||
|
||||
#. module: base_partner_one2many_phone
|
||||
#: model:ir.model,name:base_partner_one2many_phone.model_res_partner
|
||||
msgid "Partner"
|
||||
msgstr "Partenaire"
|
||||
|
||||
#. module: base_partner_one2many_phone
|
||||
#: field:res.partner.phone,phone:0
|
||||
msgid "Phone"
|
||||
msgstr "Numéro de tél."
|
||||
|
||||
#. module: base_partner_one2many_phone
|
||||
#: field:res.partner.phone,type:0
|
||||
msgid "Phone Type"
|
||||
msgstr "Type de téléphone"
|
||||
|
||||
#. module: base_partner_one2many_phone
|
||||
#: selection:res.partner.phone,type:0
|
||||
msgid "Phone/fax Home"
|
||||
msgstr "Domicile tél./fax"
|
||||
|
||||
#. module: base_partner_one2many_phone
|
||||
#: model:ir.actions.act_window,name:base_partner_one2many_phone.res_partner_phone_action
|
||||
#: model:ir.ui.menu,name:base_partner_one2many_phone.res_partner_phone_menu
|
||||
#: field:res.partner,phone_ids:0 view:res.partner.phone:0
|
||||
msgid "Phones"
|
||||
msgstr "Numéro de tél."
|
||||
|
||||
#. module: base_partner_one2many_phone
|
||||
#: field:res.partner.phone,partner_id:0
|
||||
msgid "Related Partner"
|
||||
msgstr "Partenaire lié"
|
||||
|
||||
#. module: base_partner_one2many_phone
|
||||
#: model:ir.model,name:base_partner_one2many_phone.model_res_partner_phone
|
||||
msgid "res.partner.phone"
|
||||
msgstr "res.partner.phone"
|
||||
56
base_partner_one2many_phone/partner_phone.py
Normal file
56
base_partner_one2many_phone/partner_phone.py
Normal file
@@ -0,0 +1,56 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# © 2014-2016 Abbaye du Barroux (http://www.barroux.org)
|
||||
# © 2016 Akretion (http://www.akretion.com>)
|
||||
# @author: Frère Bernard <informatique@barroux.org>
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import models, fields, api
|
||||
from odoo.addons.base_phone.fields import Phone, Fax
|
||||
|
||||
|
||||
class ResPartnerPhone(models.Model):
|
||||
_name = 'res.partner.phone'
|
||||
_order = 'partner_id, type'
|
||||
|
||||
partner_id = fields.Many2one('res.partner', string='Related Partner')
|
||||
type = fields.Selection([
|
||||
('1_home', 'Home'),
|
||||
('2_mobile', 'Mobile'),
|
||||
('3_office', 'Office'),
|
||||
('4_home_fax', 'Home Fax'),
|
||||
('5_office_fax', 'Office Fax'),
|
||||
('6_phone_fax_home', 'Phone/fax Home'),
|
||||
('7_other', 'Other')],
|
||||
string='Phone Type', required=True)
|
||||
phone = Phone('Phone', required=True, partner_field='partner_id')
|
||||
note = fields.Char('Note')
|
||||
|
||||
|
||||
class ResPartner(models.Model):
|
||||
_inherit = 'res.partner'
|
||||
|
||||
@api.one
|
||||
@api.depends('phone_ids.phone', 'phone_ids.type')
|
||||
def _compute_partner_phone(self):
|
||||
phone = mobile = fax = False
|
||||
for partner_phone in self.phone_ids:
|
||||
not_phone_type = ('2_mobile', '4_home_fax', '5_office_fax')
|
||||
if partner_phone.type not in not_phone_type:
|
||||
phone = partner_phone.phone
|
||||
if partner_phone.type == '2_mobile':
|
||||
mobile = partner_phone.phone
|
||||
if partner_phone.type in ('5_office_fax', '4_home_fax'):
|
||||
fax = partner_phone.phone
|
||||
self.phone = phone
|
||||
self.mobile = mobile
|
||||
self.fax = fax
|
||||
|
||||
phone_ids = fields.One2many(
|
||||
'res.partner.phone', 'partner_id', string='Phones')
|
||||
phone = Phone(
|
||||
compute='_compute_partner_phone', store=True, readonly=True)
|
||||
mobile = Phone(
|
||||
compute='_compute_partner_phone', store=True, readonly=True)
|
||||
fax = Fax(
|
||||
compute='_compute_partner_phone', store=True, readonly=True)
|
||||
93
base_partner_one2many_phone/partner_phone_view.xml
Normal file
93
base_partner_one2many_phone/partner_phone_view.xml
Normal file
@@ -0,0 +1,93 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
© 2014-2016 Abbaye du Barroux (http://www.barroux.org)
|
||||
© 2016 Akretion (http://www.akretion.com>)
|
||||
@author: Frère Bernard <informatique@barroux.org>
|
||||
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
|
||||
<!-- Partner phones -->
|
||||
<record id="res_partner_phone_tree" model="ir.ui.view">
|
||||
<field name="name">res.partner.phone.tree</field>
|
||||
<field name="model">res.partner.phone</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Phones" editable="bottom">
|
||||
<field name="partner_id" invisible="not context.get('partner_phone_main_view')"/>
|
||||
<field name="type"/>
|
||||
<field name="phone" widget="phone"/>
|
||||
<field name="note"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="res_partner_phone_search" model="ir.ui.view">
|
||||
<field name="name">res.partner.phone.search</field>
|
||||
<field name="model">res.partner.phone</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search Phones">
|
||||
<field name="phone" />
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="res_partner_phone_action" model="ir.actions.act_window">
|
||||
<field name="name">Phones</field>
|
||||
<field name="res_model">res.partner.phone</field>
|
||||
<field name="view_mode">tree</field>
|
||||
<field name="context">{'partner_phone_main_view': True}</field>
|
||||
</record>
|
||||
|
||||
<menuitem id="res_partner_phone_menu" action="res_partner_phone_action"
|
||||
parent="sales_team.menu_sales" sequence="2"/>
|
||||
|
||||
<record id="view_partner_form" model="ir.ui.view">
|
||||
<field name="name">add.phone_ids.on.partner.form</field>
|
||||
<field name="model">res.partner</field>
|
||||
<field name="inherit_id" ref="base.view_partner_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="phone" position="after">
|
||||
<field name="phone_ids" nolabel="1" colspan="2"/>
|
||||
</field>
|
||||
<field name="phone" position="attributes">
|
||||
<attribute name="invisible">1</attribute>
|
||||
</field>
|
||||
<field name="mobile" position="attributes">
|
||||
<attribute name="invisible">1</attribute>
|
||||
</field>
|
||||
<field name="fax" position="attributes">
|
||||
<attribute name="invisible">1</attribute>
|
||||
</field>
|
||||
<xpath expr="//field[@name='child_ids']/form//field[@name='phone']" position="after">
|
||||
<field name="phone_ids" nolabel="1" colspan="2"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='child_ids']/form//field[@name='phone']" position="attributes">
|
||||
<attribute name="invisible">1</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='child_ids']/form//field[@name='mobile']" position="attributes">
|
||||
<attribute name="invisible">1</attribute>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_partner_simple_form" model="ir.ui.view">
|
||||
<field name="name">add.phone_ids.on.res.partner.simplified.form</field>
|
||||
<field name="model">res.partner</field>
|
||||
<field name="inherit_id" ref="base.view_partner_simple_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="phone" position="after">
|
||||
<field name="phone_ids" nolabel="1" colspan="2"/>
|
||||
</field>
|
||||
<field name="phone" position="attributes">
|
||||
<attribute name="invisible">1</attribute>
|
||||
</field>
|
||||
<field name="mobile" position="attributes">
|
||||
<attribute name="invisible">1</attribute>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
</odoo>
|
||||
3
base_partner_one2many_phone/security/ir.model.access.csv
Normal file
3
base_partner_one2many_phone/security/ir.model.access.csv
Normal file
@@ -0,0 +1,3 @@
|
||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
access_partner_phone_full,Full access on res.partner.phone to Contact Manager grp,model_res_partner_phone,base.group_partner_manager,1,1,1,1
|
||||
access_partner_phone_read,Read access on res.partner.phone to Employees grp,model_res_partner_phone,base.group_user,1,0,0,0
|
||||
|
Reference in New Issue
Block a user