Added share wizard in res.partner

bzr revid: rga@rga-desktop-20100518153422-v3d985fe68tgk1ed
This commit is contained in:
rga 2010-05-18 21:04:22 +05:30
parent 321c9415ab
commit fd14d4aa03
5 changed files with 84 additions and 8 deletions

View File

@ -56,6 +56,7 @@
'res/bank_view.xml',
'res/country_view.xml',
'res/res_currency_view.xml',
'res/partner/wizard/wizard_share_view.xml',
'res/partner/crm_view.xml',
'res/partner/partner_data.xml',
'res/ir_property_view.xml',

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
#
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
@ -15,7 +15,7 @@
# 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/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
@ -149,12 +149,12 @@ class res_partner(osv.osv):
'active': fields.boolean('Active'),
'customer': fields.boolean('Customer', help="Check this box if the partner is a customer."),
'supplier': fields.boolean('Supplier', help="Check this box if the partner is a supplier. If it's not checked, purchase people will not see it when encoding a purchase order."),
'city': fields.related('address', 'city', type='char', string='City'),
'phone': fields.related('address', 'phone', type='char', string='Phone'),
'city': fields.related('address', 'city', type='char', string='City'),
'phone': fields.related('address', 'phone', type='char', string='Phone'),
'country': fields.related('address', 'country_id', type='many2one', relation='res.country', string='Country'),
'employee': fields.boolean('Employee', help="Check this box if the partner is an Employee."),
'email': fields.related('address', 'email', type='char', size=240, string='E-mail'),
'company_id': fields.many2one('res.company', 'Company', select=1),
'company_id': fields.many2one('res.company', 'Company', select=1),
}
def _default_category(self, cr, uid, context={}):
@ -173,6 +173,9 @@ class res_partner(osv.osv):
default.update({'name': name+ _(' (copy)'), 'events':[]})
return super(res_partner, self).copy(cr, uid, id, default, context)
def do_share(self, cr, uid, ids, *args):
return True
def _check_ean_key(self, cr, uid, ids):
for partner_o in pooler.get_pool(cr.dbname).get('res.partner').read(cr, uid, ids, ['ean13',]):
thisean=partner_o['ean13']
@ -469,7 +472,7 @@ class res_partner_category(osv.osv):
_columns = {
'partner_ids': fields.many2many('res.partner', 'res_partner_category_rel', 'category_id', 'partner_id', 'Partners'),
}
res_partner_category()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
#
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
@ -15,7 +15,7 @@
# 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/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
@ -23,6 +23,7 @@ import wizard_sms
import wizard_spam
import wizard_clear_ids
import wizard_ean_check
import wizard_share
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,30 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from osv import osv, fields
class partner_share_create(osv.osv_memory):
_name = 'partner.share.create'
_description = 'Create parner share'
_columns = {
'user_ids': fields.many2many('res.users', 'share_patner_rel', 'partner_id','user_id', 'Share Users'),
}
partner_share_create()

View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="res_partner_share" model="ir.ui.view">
<field name="name">partner.share.create.form</field>
<field name="model">partner.share.create</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Share">
<separator colspan="4" string="Users"/>
<field name="user_ids" colspan="4" nolabel="1"/>
<separator colspan="4"/>
<group col="2" colspan="4">
<button special="cancel" string="Cancel" icon='gtk-cancel'/>
<button name="do_share" string="Share" colspan="1" type="object" icon="gtk-execute"/>
</group>
</form>
</field>
</record>
<record id="res_partner_share_act" model="ir.actions.act_window">
<field name="name">Share</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">partner.share.create</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<record model="ir.values" id="res_partner_share_values">
<field name="model_id" ref="model_res_partner" />
<field name="object" eval="1" />
<field name="name">Share</field>
<field name="key2">client_action_multi</field>
<field name="value" eval="'ir.actions.act_window,' + str(ref('res_partner_share_act'))" />
<field name="key">action</field>
<field name="model">res.partner</field>
</record>
</data>
</openerp>