[MERGE] merged useability work from lp:~openerp-commiter/openobject-server/trunk_useability_server/
bzr revid: hmo@hmo-20100525145219-ootdrhj0tgg58efw
This commit is contained in:
commit
de55205c1d
|
@ -58,6 +58,7 @@
|
|||
'res/country_view.xml',
|
||||
'res/res_currency_view.xml',
|
||||
'res/partner/crm_view.xml',
|
||||
'res/partner/wizard/partner_sms_send_view.xml',
|
||||
'res/partner/partner_data.xml',
|
||||
'res/ir_property_view.xml',
|
||||
'security/base_security.xml',
|
||||
|
|
|
@ -12,23 +12,25 @@
|
|||
<field name="active" select="2"/>
|
||||
<field name="bic" select="1"/>
|
||||
<newline/>
|
||||
<group string="Address" colspan="2" col="4">
|
||||
<field name="street" select="2"/>
|
||||
<field name="street2" select="2"/>
|
||||
<field name="zip"/>
|
||||
<field name="city"/>
|
||||
<field name="country" select="2"/>
|
||||
<field name="state" select="2"/>
|
||||
<separator string="Address" colspan="2" col="4"/>
|
||||
<separator string="Communication" colspan="2" col="4"/>
|
||||
<group colspan="2" col="4">
|
||||
<field name="street" select="2"/>
|
||||
<field name="street2" select="2"/>
|
||||
<field name="zip"/>
|
||||
<field name="city"/>
|
||||
<field name="country" select="2"/>
|
||||
<field name="state" select="2"/>
|
||||
</group>
|
||||
<group string="Communication" colspan="2" col="4">
|
||||
<field name="phone"/>
|
||||
<field name="fax"/>
|
||||
<field name="email"/>
|
||||
<group colspan="2" col="4">
|
||||
<field name="phone"/>
|
||||
<field name="fax"/>
|
||||
<field name="email"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="view_res_bank_tree" model="ir.ui.view">
|
||||
<field name="name">res.bank.tree</field>
|
||||
<field name="model">res.bank</field>
|
||||
|
@ -41,15 +43,15 @@
|
|||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="action_res_bank_form" model="ir.actions.act_window">
|
||||
<field name="name">Bank List</field>
|
||||
<field name="res_model">res.bank</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
|
||||
|
||||
<menuitem action="action_res_bank_form" groups="group_extended" id="menu_action_res_bank_form" parent="menu_base_config" sequence="40"/>
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -124,7 +124,7 @@ class res_partner(osv.osv):
|
|||
'user_id': fields.many2one('res.users', 'Salesman', help='The internal user that is in charge of communicating with this partner if any.'),
|
||||
'vat': fields.char('VAT',size=32 ,help="Value Added Tax number. Check the box if the partner is subjected to the VAT. Used by the VAT legal statement."),
|
||||
'bank_ids': fields.one2many('res.partner.bank', 'partner_id', 'Banks'),
|
||||
'website': fields.char('Website',size=64),
|
||||
'website': fields.char('Website',size=64, help="Website of Partner"),
|
||||
'comment': fields.text('Notes'),
|
||||
'address': fields.one2many('res.partner.address', 'partner_id', 'Contacts'),
|
||||
'category_id': fields.many2many('res.partner.category', 'res_partner_category_rel', 'partner_id', 'category_id', 'Categories'),
|
||||
|
@ -136,6 +136,7 @@ class res_partner(osv.osv):
|
|||
'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'),
|
||||
'mobile': fields.related('address', 'mobile', type='char', string='Mobile'),
|
||||
'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'),
|
||||
|
@ -290,6 +291,8 @@ class res_partner_address(osv.osv):
|
|||
'fax': fields.char('Fax', size=64),
|
||||
'mobile': fields.char('Mobile', size=64),
|
||||
'birthdate': fields.char('Birthdate', size=64),
|
||||
'is_customer_add': fields.related('partner_id', 'customer', type='boolean', string='Customer'),
|
||||
'is_supplier_add': fields.related('partner_id', 'supplier', type='boolean', string='Supplier'),
|
||||
'active': fields.boolean('Active', help="Uncheck the active field to hide the contact."),
|
||||
# 'company_id': fields.related('partner_id','company_id',type='many2one',relation='res.company',string='Company', store=True),
|
||||
'company_id': fields.many2one('res.company', 'Company',select=1),
|
||||
|
|
|
@ -21,10 +21,21 @@
|
|||
<field name="type">search</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search Contact">
|
||||
<field name="name" select='1'/>
|
||||
<field name="partner_id" select='1'/>
|
||||
<field name="country_id" select='1'/>
|
||||
</search>
|
||||
<group>
|
||||
<filter string="Customer" name="customer" icon="terp-crm" domain="[('is_customer_add','=','1')]" />
|
||||
<filter string="Supplier" name="supplier" icon="terp-crm" domain="[('is_supplier_add','=','1')]" />
|
||||
<separator orientation="vertical"/>
|
||||
<field name="name" />
|
||||
<field name="partner_id" />
|
||||
<field name="country_id" />
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="1" string="Group By...">
|
||||
<filter string="Partner" icon="terp-crm" domain="[]" context="{'group_by' : 'partner_id'}" />
|
||||
<filter string="Country" icon="terp-crm" domain="[]" context="{'group_by' : 'country_id'}" />
|
||||
<filter string="Type" icon="terp-crm" domain="[]" context="{'group_by' : 'type'}" />
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
@ -92,6 +103,7 @@
|
|||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">res.partner.address</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="context">{"search_default_customer":1}</field>
|
||||
<field name="search_view_id" ref="view_res_partner_address_filter"/>
|
||||
</record>
|
||||
<record id="action_partner_address_form_view1" model="ir.actions.act_window.view">
|
||||
|
@ -281,8 +293,10 @@
|
|||
<field name="email"/>
|
||||
</tree>
|
||||
</field>
|
||||
<separator colspan="4" string="Categories"/>
|
||||
<field colspan="4" name="category_id" nolabel="1" height="90" groups="base.group_extended"/>
|
||||
<group groups="base.group_extended">
|
||||
<separator colspan="4" string="Categories"/>
|
||||
<field colspan="4" name="category_id" nolabel="1"/>
|
||||
</group>
|
||||
</page>
|
||||
<page string="Sales & Purchases">
|
||||
<separator string="General Information" colspan="4"/>
|
||||
|
@ -294,12 +308,13 @@
|
|||
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
|
||||
<newline/>
|
||||
</page>
|
||||
<page string="History">
|
||||
<field colspan="4" name="events" nolabel="1" widget="one2many_list"/>
|
||||
</page>
|
||||
<page string="Notes">
|
||||
<field colspan="4" name="comment" nolabel="1"/>
|
||||
</page>
|
||||
<page string="History">
|
||||
<field colspan="4" name="events" nolabel="1" widget="one2many_list"/>
|
||||
</page>
|
||||
|
||||
</notebook>
|
||||
</form>
|
||||
</field>
|
||||
|
@ -324,7 +339,7 @@
|
|||
</field>
|
||||
</group>
|
||||
<newline />
|
||||
<group expand="0" string="Group By..." colspan="16">
|
||||
<group expand="1" string="Group By...">
|
||||
<filter string="Salesman" icon="terp-crm" domain="[]" context="{'group_by' : 'user_id'}" />
|
||||
</group>
|
||||
</search>
|
||||
|
@ -487,40 +502,6 @@
|
|||
</field>
|
||||
</record>
|
||||
|
||||
<!--
|
||||
======================
|
||||
Company Architecture
|
||||
======================
|
||||
-->
|
||||
<record id="view_partner_tree2" model="ir.ui.view">
|
||||
<field name="name">res.partner.tree</field>
|
||||
<field name="model">res.partner</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="field_parent">child_ids</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Partners">
|
||||
<field name="name"/>
|
||||
<field name="lang"/>
|
||||
<field name="ref"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
<record id="action2" model="ir.actions.act_window">
|
||||
<field name="name">Company Architecture</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">res.partner</field>
|
||||
<field name="domain">[('id','in',active_ids)]</field>
|
||||
<field name="view_type">tree</field>
|
||||
<field name="view_id" ref="view_partner_tree2"/>
|
||||
</record>
|
||||
<record id="ir_partner_structure" model="ir.values">
|
||||
<field eval="'client_action_multi'" name="key2"/>
|
||||
<field eval="'res.partner'" name="model"/>
|
||||
<field name="name">Company Architecture</field>
|
||||
<field eval="'ir.actions.act_window,'+str(action2)" name="value"/>
|
||||
<field eval="True" name="object"/>
|
||||
</record>
|
||||
|
||||
<!--
|
||||
======================
|
||||
Categories
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<wizard id="res_partner_send_sms_wizard" model="res.partner" name="res.partner.sms_send" string="Send SMS"/>
|
||||
<data>
|
||||
<wizard id="res_partner_mass_mailing_wizard" model="res.partner" name="res.partner.spam_send" string="Mass Mailing"/>
|
||||
<!--
|
||||
<wizard string="Check EAN13" model="res.partner" name="res.partner.ean13"/>
|
||||
<wizard string="Clear IDs" model="res.partner" name="res.partner.clear_ids"/>
|
||||
-->
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
|
@ -15,14 +15,14 @@
|
|||
# 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard_sms
|
||||
import wizard_spam
|
||||
import wizard_clear_ids
|
||||
import wizard_ean_check
|
||||
import partner_sms_send
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -0,0 +1,84 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
import netsvc
|
||||
import tools
|
||||
from osv import fields, osv
|
||||
|
||||
class partner_sms_send(osv.osv_memory):
|
||||
""" Create Menu """
|
||||
|
||||
_name = "partner.sms.send"
|
||||
_description = "Send SMS"
|
||||
|
||||
_columns = {
|
||||
'mobile_to': fields.char('To', size=256, required=True),
|
||||
'app_id': fields.char('API ID', size=256,required=True),
|
||||
'user': fields.char('Login', size=256,required=True),
|
||||
'password': fields.char('Password', size=256,required=True),
|
||||
'text': fields.text('SMS Message',required=True),
|
||||
}
|
||||
|
||||
def default_get(self, cr, uid, fields, context=None):
|
||||
"""
|
||||
This function gets default values
|
||||
@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param fields: List of fields for default value
|
||||
@param context: A standard dictionary for contextual values
|
||||
|
||||
@return : default values of fields.
|
||||
"""
|
||||
partner_pool = self.pool.get('res.partner')
|
||||
active_ids = context and context.get('active_ids', [])
|
||||
res = {}
|
||||
for partner in partner_pool.browse(cr, uid, active_ids, context=context):
|
||||
if 'mobile_to' in fields:
|
||||
res.update({'mobile_to': partner.mobile})
|
||||
return res
|
||||
|
||||
def sms_send(self, cr, uid, ids, context):
|
||||
"""
|
||||
to send sms
|
||||
|
||||
@param cr: the current row, from the database cursor.
|
||||
@param uid: the current user’s ID for security checks.
|
||||
@param ids: the ID or list of IDs
|
||||
@param context: A standard dictionary
|
||||
@return: number indicating the acknowledgement
|
||||
"""
|
||||
nbr = 0
|
||||
|
||||
for data in self.browse(cr, uid, ids, context) :
|
||||
tools.sms_send(
|
||||
data.user,
|
||||
data.password,
|
||||
data.app_id,
|
||||
tools.ustr(data.text),
|
||||
data.mobile_to)
|
||||
nbr += 1
|
||||
return {}
|
||||
partner_sms_send()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- Create Menu From view -->
|
||||
|
||||
<record id="view_partner_sms_send" model="ir.ui.view">
|
||||
<field name="name">Send SMS</field>
|
||||
<field name="model">partner.sms.send</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="SMS - Gateway: clickatell">
|
||||
<separator string="Bulk SMS send" colspan="4"/>
|
||||
<field name="mobile_to"/>
|
||||
<field name="app_id"/>
|
||||
<field name="user"/>
|
||||
<field name="password"/>
|
||||
<separator string="Message" colspan="4" />
|
||||
<field name="text" colspan="4" nolabel="1"/>
|
||||
<separator string="" colspan="4" />
|
||||
<group colspan="4" col="6">
|
||||
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
|
||||
<button name="sms_send" string="Send SMS" type="object" icon="gtk-go-back"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<act_window name="SMS Send"
|
||||
res_model="partner.sms.send"
|
||||
src_model="res.partner"
|
||||
view_mode="form"
|
||||
target="new"
|
||||
key2="client_action_multi"
|
||||
id="action_partner_sms_send"
|
||||
groups="base.group_extended"/>
|
||||
</data>
|
||||
</openerp>
|
|
@ -1,74 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
import netsvc
|
||||
import tools
|
||||
|
||||
sms_send_form = '''<?xml version="1.0"?>
|
||||
<form string="%s">
|
||||
<separator string="%s" colspan="4"/>
|
||||
<field name="app_id"/>
|
||||
<newline/>
|
||||
<field name="user"/>
|
||||
<field name="password"/>
|
||||
<newline/>
|
||||
<field name="text" colspan="4"/>
|
||||
</form>''' % ('SMS - Gateway: clickatell','Bulk SMS send')
|
||||
|
||||
sms_send_fields = {
|
||||
'app_id': {'string':'API ID', 'type':'char', 'required':True},
|
||||
'user': {'string':'Login', 'type':'char', 'required':True},
|
||||
'password': {'string':'Password', 'type':'char', 'required':True},
|
||||
'text': {'string':'SMS Message', 'type':'text', 'required':True}
|
||||
}
|
||||
|
||||
def _sms_send(self, cr, uid, data, context):
|
||||
service = netsvc.LocalService("object_proxy")
|
||||
|
||||
res_ids = service.execute(cr.dbname, uid, 'res.partner.address', 'search', [('partner_id','in',data['ids']),('type','=','default')])
|
||||
res = service.execute(cr.dbname, uid, 'res.partner.address', 'read', res_ids, ['mobile'])
|
||||
|
||||
nbr = 0
|
||||
for r in res:
|
||||
to = r['mobile']
|
||||
if to:
|
||||
tools.sms_send(data['form']['user'], data['form']['password'], data['form']['app_id'], unicode(data['form']['text'], 'utf-8').encode('latin1'), to)
|
||||
nbr += 1
|
||||
return {'sms_sent': nbr}
|
||||
|
||||
class part_sms(wizard.interface):
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [],
|
||||
'result': {'type': 'form', 'arch':sms_send_form, 'fields': sms_send_fields, 'state':[('end','Cancel'), ('send','Send SMS')]}
|
||||
},
|
||||
'send': {
|
||||
'actions': [_sms_send],
|
||||
'result': {'type': 'state', 'state':'end'}
|
||||
}
|
||||
}
|
||||
part_sms('res.partner.sms_send')
|
||||
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
Loading…
Reference in New Issue