[MERGE] improvements in the crm, sale and stock addons

bzr revid: stw@openerp.com-20120803093625-usuixd544cpzxpze
This commit is contained in:
Stephane Wirtel 2012-08-03 11:36:25 +02:00
commit a643848ad4
5 changed files with 37 additions and 24 deletions

View File

@ -278,7 +278,7 @@ class crm_lead(base_stage, osv.osv):
self.create_send_note(cr, uid, [obj_id], context=context)
return obj_id
def onchange_stage_id(self, cr, uid, ids, stage_id, context={}):
def onchange_stage_id(self, cr, uid, ids, stage_id, context=None):
if not stage_id:
return {'value':{}}
stage = self.pool.get('crm.case.stage').browse(cr, uid, stage_id, context)
@ -286,6 +286,14 @@ class crm_lead(base_stage, osv.osv):
return {'value':{}}
return {'value':{'probability': stage.probability}}
def on_change_partner(self, cr, uid, ids, partner_id, context=None):
result = {}
if partner_id:
partner = self.pool.get('res.partner').browse(cr, uid, partner_id, context=context)
result = {'partner_name' : partner.name}
return {'value' : result}
def _check(self, cr, uid, ids=False, context=None):
""" Override of the base.stage method.
Function called by the scheduler to process cases for date actions

View File

@ -129,10 +129,6 @@
</header>
<sheet>
<div class="oe_right oe_button_box" name="buttons">
<button type="action"
name="%(act_crm_opportunity_crm_meeting_new)d"
string="Meetings" />
<button type="action"
name="%(act_crm_opportunity_crm_phonecall_new)d"
string="Phone Calls" />
@ -142,20 +138,10 @@
<h1><field name="name" placeholder="Describe the lead..."/></h1>
</div>
<group>
<group>
<field name="user_id" />
<field name="section_id"/>
<field name="type" invisible="1"/>
</group>
<group>
<field name="priority"/>
<field name="categ_ids"
widget="many2many_tags"
domain="[('object_id.model','=','crm.lead')]"/>
</group>
<group>
<field name="partner_name" string="Company Name"/>
<field name="partner_id" string="Customer"/>
<field name="partner_id" string="Customer"
on_change="on_change_partner(partner_id)" />
<label for="street" string="Address"/>
<div>
<field name="street" placeholder="Street..."/>
@ -186,6 +172,17 @@
icon="terp-mail-message-new" type="action" colspan="1"/>
-->
</group>
<group>
<field name="user_id" />
<field name="section_id"/>
<field name="type" invisible="1"/>
</group>
<group>
<field name="priority"/>
<field name="categ_ids"
widget="many2many_tags"
domain="[('object_id.model','=','crm.lead')]"/>
</group>
</group>
<notebook colspan="4">
<page string="Notes">
@ -432,9 +429,11 @@
<button string="Schedule/Log Call"
name="%(opportunity2phonecall_act)d"
type="action"/>
<button string="Schedule Meeting"
<button string="Meeting"
name="action_makeMeeting"
type="object"/>
type="object"
context="{'search_default_attendee_id': active_id, 'default_attendee_id' : active_id}"
/>
</div>
<div class="oe_title">
<label for="name" class="oe_edit_only"/>

View File

@ -143,7 +143,7 @@ class crm_make_sale(osv.osv_memory):
_columns = {
'shop_id': fields.many2one('sale.shop', 'Shop', required=True),
'partner_id': fields.many2one('res.partner', 'Customer', required=True, domain=[('customer','=',True)]),
'close': fields.boolean('Close Opportunity', help='Check this to close the opportunity after having created the sale order.'),
'close': fields.boolean('Mark Won', help='Check this to close the opportunity after having created the sale order.'),
}
_defaults = {
'shop_id': _get_shop_id,

View File

@ -1547,6 +1547,7 @@ class stock_move(osv.osv):
cr.execute('select id from stock_tracking where create_uid=%s order by id desc limit 1', (uid,))
res = cr.fetchone()
return (res and res[0]) or False
_name = "stock.move"
_description = "Stock Move"
_order = 'date_expected desc, id'
@ -1744,6 +1745,13 @@ class stock_move(osv.osv):
'date_expected': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
}
def create(self, cr, uid, vals, context=None):
# TODO
# the create_date is passed in the vals dict, and the ORM has a problem with that !
# make a real patch and remove this workaround
vals.pop('create_date', False)
return super(stock_move, self).create(cr, uid, vals, context=context)
def write(self, cr, uid, ids, vals, context=None):
if isinstance(ids, (int, long)):
ids = [ids]

View File

@ -120,10 +120,8 @@
<sheet>
<div>
<label for="name" class="oe_edit_only"/>
<h1>
<field name="name" placeholder="e.g. Annual inventory" class="oe_inline"/> -
<field name="date" class="oe_inline"/>
</h1>
<field name="name" placeholder="e.g. Annual inventory" class="oe_inline"/> -
<field name="date" class="oe_inline"/>
</div>
<group>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>