[IMP]improve view of contract and open chatter notification added when state changed
bzr revid: sgo@tinyerp.com-20120622091008-uy805uph0hz4vk0h
This commit is contained in:
parent
6aea583ad9
commit
95cd61d1f5
|
@ -494,7 +494,6 @@ class account_analytic_account(osv.osv):
|
|||
res['value']['pricelist_id'] = template.pricelist_id.id
|
||||
res['value']['description'] = template.description
|
||||
return res
|
||||
|
||||
account_analytic_account()
|
||||
|
||||
class account_analytic_account_summary_user(osv.osv):
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
<xpath expr='//field[@name="type"]' position='after'>
|
||||
<field name="template_id" on_change="on_change_template(template_id,context)" domain="[('type','=','template')]" attrs="{'invisible': [('type','in',['view', 'normal','template'])]}" context="{'default_type' : 'template'}"/>
|
||||
</xpath>
|
||||
<xpath expr='//field[@name="date"]' position="after" version="7.0">
|
||||
<xpath expr='//div[@name="duration"]' position="after" version="7.0">
|
||||
<label for="quantity_max"/>
|
||||
<div>
|
||||
<field name="quantity_max" class="oe_form_inline"/> / Remaining:
|
||||
|
|
|
@ -272,7 +272,20 @@ class account_analytic_account(osv.osv):
|
|||
else:
|
||||
account = self.search(cr, uid, args, limit=limit, context=context)
|
||||
return self.name_get(cr, uid, account, context=context)
|
||||
|
||||
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
contract = super(account_analytic_account, self).create(cr, uid, vals, context=context)
|
||||
if contract:
|
||||
self.create_send_note(cr, uid, [contract], context=context)
|
||||
return contract
|
||||
# ------------------------------------------------
|
||||
# OpenChatter methods and notifications
|
||||
# ------------------------------------------------
|
||||
def create_send_note(self, cr, uid, ids, context=None):
|
||||
for obj in self.browse(cr, uid, ids, context=context):
|
||||
self.message_subscribe(cr, uid, [obj.id], [obj.user_id.id], context=context)
|
||||
self.message_append_note(cr, uid, [obj.id], body=_("Contract for <em>%s</em> has been <b>created</b>.") % (obj.partner_id.name), context=context)
|
||||
|
||||
account_analytic_account()
|
||||
|
||||
|
||||
|
|
|
@ -29,8 +29,10 @@
|
|||
<page string="Contract Information" name="contract_page" attrs="{'invisible':[('type','not in',['contract', 'template'])]}">
|
||||
<group name="master">
|
||||
<group string="Validity" name="contract">
|
||||
<field name="date_start"/>
|
||||
<field name="date"/>
|
||||
<label string="Duration"/>
|
||||
<div name="duration">
|
||||
<field name="date_start"/> - <field name="date"/>
|
||||
</div>
|
||||
</group>
|
||||
<group name="project">
|
||||
<separator string="Project Management" name="project_sep" invisible="1"/>
|
||||
|
|
|
@ -94,16 +94,40 @@ class account_analytic_account(osv.osv):
|
|||
return res
|
||||
|
||||
def set_close(self, cr, uid, ids, context=None):
|
||||
return self.write(cr, uid, ids, {'state':'close'}, context=context)
|
||||
self.write(cr, uid, ids, {'state':'close'}, context=context)
|
||||
self.set_close_send_note(cr, uid, ids, context)
|
||||
return True
|
||||
|
||||
def set_cancel(self, cr, uid, ids, context=None):
|
||||
return self.write(cr, uid, ids, {'state':'cancelled'}, context=context)
|
||||
self.write(cr, uid, ids, {'state':'cancelled'}, context=context)
|
||||
self.set_cancel_send_note(cr, uid, ids, context)
|
||||
return True
|
||||
|
||||
def set_open(self, cr, uid, ids, context=None):
|
||||
return self.write(cr, uid, ids, {'state':'open'}, context=context)
|
||||
self.write(cr, uid, ids, {'state':'open'}, context=context)
|
||||
self.set_open_send_note(cr, uid, ids, context)
|
||||
return True
|
||||
|
||||
def set_pending(self, cr, uid, ids, context=None):
|
||||
return self.write(cr, uid, ids, {'state':'pending'}, context=context)
|
||||
self.write(cr, uid, ids, {'state':'pending'}, context=context)
|
||||
self.set_pending_send_note(cr, uid, ids, context)
|
||||
return True
|
||||
|
||||
def set_open_send_note(self, cr, uid, ids, context=None):
|
||||
message = _("Contract has been <b>opened</b>.")
|
||||
return self.message_append_note(cr, uid, ids, body=message, context=context)
|
||||
|
||||
def set_close_send_note(self, cr, uid, ids, context=None):
|
||||
message = _("Contract has been <b>closed</b>.")
|
||||
return self.message_append_note(cr, uid, ids, body=message, context=context)
|
||||
|
||||
def set_cancel_send_note(self, cr, uid, ids, context=None):
|
||||
message = _("Contract has been <b>cancelled</b>.")
|
||||
return self.message_append_note(cr, uid, ids, body=message, context=context)
|
||||
|
||||
def set_pending_send_note(self, cr, uid, ids, context=None):
|
||||
message = _("Contract has been <b>pending</b>.")
|
||||
return self.message_append_note(cr, uid, ids, body=message, context=context)
|
||||
|
||||
account_analytic_account()
|
||||
|
||||
|
|
Loading…
Reference in New Issue