[IMP] convert button into stat button for project_issue and stock_claim
bzr revid: rma@tinyerp.com-20140324050921-qxn3n4getus3il6c
This commit is contained in:
parent
b51066b500
commit
0f40b3bc8f
|
@ -9,7 +9,6 @@
|
||||||
<field name="context">{'default_ref': 'stock.picking.out,'+str(context.get('active_id', False))}</field>
|
<field name="context">{'default_ref': 'stock.picking.out,'+str(context.get('active_id', False))}</field>
|
||||||
<field name="domain">[('ref','=','stock.picking.out,'+str(context.get('active_id',False)))]</field>
|
<field name="domain">[('ref','=','stock.picking.out,'+str(context.get('active_id',False)))]</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="crm_claim_from_delivery" model="ir.ui.view">
|
<record id="crm_claim_from_delivery" model="ir.ui.view">
|
||||||
<field name="name">crm.claim.from_delivery.form</field>
|
<field name="name">crm.claim.from_delivery.form</field>
|
||||||
<field name="model">stock.picking.out</field>
|
<field name="model">stock.picking.out</field>
|
||||||
|
@ -17,11 +16,13 @@
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr="/form/sheet/h1" position="before">
|
<xpath expr="/form/sheet/h1" position="before">
|
||||||
<div class="oe_right oe_button_box">
|
<div class="oe_right oe_button_box">
|
||||||
<button name="%(action_claim_from_delivery)d" string="Claims" type="action"/>
|
<button class="oe_inline oe_stat_button" type="action"
|
||||||
|
name="%(action_claim_from_delivery)d" icon="fa-comments" >
|
||||||
|
<field string="Claims" name="claim_count" widget="statinfo"/>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</xpath>
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
</data>
|
</data>
|
||||||
</openerp>
|
</openerp>
|
||||||
|
|
|
@ -214,7 +214,14 @@ class crm_lead(format_address, osv.osv):
|
||||||
duration = len(no_days)
|
duration = len(no_days)
|
||||||
res[lead.id][field] = abs(int(duration))
|
res[lead.id][field] = abs(int(duration))
|
||||||
return res
|
return res
|
||||||
|
def _meeting_count(self, cr, uid, ids, field_name, arg, context=None):
|
||||||
|
res = dict(map(lambda x: (x,0), ids))
|
||||||
|
try:
|
||||||
|
for meeting in self.browse(cr, uid, ids, context=context):
|
||||||
|
res[meeting.id] = len(meeting.opportunity_ids)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
return res
|
||||||
_columns = {
|
_columns = {
|
||||||
'partner_id': fields.many2one('res.partner', 'Partner', ondelete='set null', track_visibility='onchange',
|
'partner_id': fields.many2one('res.partner', 'Partner', ondelete='set null', track_visibility='onchange',
|
||||||
select=True, help="Linked partner (optional). Usually created when converting the lead."),
|
select=True, help="Linked partner (optional). Usually created when converting the lead."),
|
||||||
|
@ -289,6 +296,8 @@ class crm_lead(format_address, osv.osv):
|
||||||
'payment_mode': fields.many2one('crm.payment.mode', 'Payment Mode', \
|
'payment_mode': fields.many2one('crm.payment.mode', 'Payment Mode', \
|
||||||
domain="[('section_id','=',section_id)]"),
|
domain="[('section_id','=',section_id)]"),
|
||||||
'planned_cost': fields.float('Planned Costs'),
|
'planned_cost': fields.float('Planned Costs'),
|
||||||
|
'opportunity_ids': fields.one2many('calendar.event', 'opportunity_id', 'Opportunities'),
|
||||||
|
'meeting_count': fields.function(_meeting_count, string='# Meetings', type='integer'),
|
||||||
}
|
}
|
||||||
|
|
||||||
_defaults = {
|
_defaults = {
|
||||||
|
|
|
@ -103,9 +103,8 @@
|
||||||
</header>
|
</header>
|
||||||
<sheet>
|
<sheet>
|
||||||
<div class="oe_right oe_button_box" name="buttons">
|
<div class="oe_right oe_button_box" name="buttons">
|
||||||
<button string="Schedule/Log Call"
|
<button class="oe_inline oe_stat_button" type="action" name="%(opportunity2phonecall_act)d" icon="fa-phone"
|
||||||
name="%(opportunity2phonecall_act)d"
|
widget="statinfo" string="Schedule/Log Call"/>
|
||||||
type="action"/>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="oe_title">
|
<div class="oe_title">
|
||||||
<label for="name" class="oe_edit_only"/>
|
<label for="name" class="oe_edit_only"/>
|
||||||
|
@ -389,11 +388,13 @@
|
||||||
</header>
|
</header>
|
||||||
<sheet>
|
<sheet>
|
||||||
<div class="oe_right oe_button_box">
|
<div class="oe_right oe_button_box">
|
||||||
<button string="Schedule/Log Call" type="action"
|
<button class="oe_inline oe_stat_button" type="action" name="%(opportunity2phonecall_act)d" icon="fa-phone"
|
||||||
name="%(opportunity2phonecall_act)d"/>
|
widget="statinfo" string="Schedule/Log Call"/>
|
||||||
<button string="Meeting" type="object"
|
<button class="oe_inline oe_stat_button" type="object"
|
||||||
name="action_makeMeeting"
|
context="{'search_default_attendee_id': active_id, 'default_attendee_id' : active_id}"
|
||||||
context="{'search_default_attendee_id': active_id, 'default_attendee_id' : active_id}"/>
|
name="action_makeMeeting" icon="fa-calendar">
|
||||||
|
<field string="Meeting" name="meeting_count" widget="statinfo"/>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="oe_title">
|
<div class="oe_title">
|
||||||
<label for="name" class="oe_edit_only"/>
|
<label for="name" class="oe_edit_only"/>
|
||||||
|
|
|
@ -190,8 +190,17 @@ class crm_claim(osv.osv):
|
||||||
|
|
||||||
class res_partner(osv.osv):
|
class res_partner(osv.osv):
|
||||||
_inherit = 'res.partner'
|
_inherit = 'res.partner'
|
||||||
|
def _claim_count(self, cr, uid, ids, field_name, arg, context=None):
|
||||||
|
res = dict(map(lambda x: (x,0), ids))
|
||||||
|
try:
|
||||||
|
for partner in self.browse(cr, uid, ids, context=context):
|
||||||
|
res[partner.id] = len(partner.claims_ids)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
return res
|
||||||
_columns = {
|
_columns = {
|
||||||
'claims_ids': fields.one2many('crm.claim', 'partner_id', 'Claims'),
|
'claims_ids': fields.one2many('crm.claim', 'partner_id', 'Claims'),
|
||||||
|
'claim_count': fields.function(_claim_count, string='# Claims', type='integer'),
|
||||||
}
|
}
|
||||||
|
|
||||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -9,11 +9,11 @@
|
||||||
<field name="priority" eval="50"/>
|
<field name="priority" eval="50"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr="//div[@name='buttons']" position="inside">
|
<xpath expr="//div[@name='buttons']" position="inside">
|
||||||
<button class="oe_inline" type="action"
|
<button class="oe_inline oe_stat_button" type="action"
|
||||||
name="%(crm_case_categ_claim0)d"
|
|
||||||
string="Claims"
|
|
||||||
context="{'search_default_partner_id': active_id, 'default_partner_id': active_id}"
|
context="{'search_default_partner_id': active_id, 'default_partner_id': active_id}"
|
||||||
groups="base.group_sale_salesman" />
|
name="%(crm_case_categ_claim0)d" icon="fa-comments" groups="base.group_sale_salesman">
|
||||||
|
<field string="Claims" name="claim_count" widget="statinfo"/>
|
||||||
|
</button>
|
||||||
</xpath>
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
|
@ -36,7 +36,8 @@
|
||||||
<field name="inherit_id" ref="crm.crm_case_form_view_leads" />
|
<field name="inherit_id" ref="crm.crm_case_form_view_leads" />
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr="//div[@name='buttons']/button" position="after">
|
<xpath expr="//div[@name='buttons']/button" position="after">
|
||||||
<button name="%(convert_lead2projectissue_wizard_action)d" string="Convert to Issue" type="action" help="Convert to Issue" />
|
<button class="oe_inline oe_stat_button" type="action" name="%(convert_lead2projectissue_wizard_action)d" icon="fa-bug"
|
||||||
|
help="Convert to Issue" widget="statinfo" string="Convert to Issue"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
|
@ -229,7 +229,6 @@ class project_issue(osv.Model):
|
||||||
if work.task_id:
|
if work.task_id:
|
||||||
issues += issue_pool.search(cr, uid, [('task_id','=',work.task_id.id)])
|
issues += issue_pool.search(cr, uid, [('task_id','=',work.task_id.id)])
|
||||||
return issues
|
return issues
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
'id': fields.integer('ID', readonly=True),
|
'id': fields.integer('ID', readonly=True),
|
||||||
'name': fields.char('Issue', size=128, required=True),
|
'name': fields.char('Issue', size=128, required=True),
|
||||||
|
@ -573,13 +572,13 @@ class res_partner(osv.osv):
|
||||||
def _issue_count(self, cr, uid, ids, field_name, arg, context=None):
|
def _issue_count(self, cr, uid, ids, field_name, arg, context=None):
|
||||||
res = dict(map(lambda x: (x,0), ids))
|
res = dict(map(lambda x: (x,0), ids))
|
||||||
try:
|
try:
|
||||||
for partner in self.browse(cr, uid, ids, context):
|
for partner in self.browse(cr, uid, ids, context=context):
|
||||||
res[partner.id] = len(partner.issue_ids)
|
res[partner.id] = len(partner.issue_ids)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
return res
|
return res
|
||||||
|
|
||||||
""" Inherits partner and adds Tasks information in the partner form """
|
""" Inherits partner and adds Issue information in the partner form """
|
||||||
_inherit = 'res.partner'
|
_inherit = 'res.partner'
|
||||||
_columns = {
|
_columns = {
|
||||||
'issue_ids': fields.one2many('project.issue', 'partner_id', 'Issues'),
|
'issue_ids': fields.one2many('project.issue', 'partner_id', 'Issues'),
|
||||||
|
|
|
@ -636,7 +636,11 @@ class stock_picking(osv.osv):
|
||||||
vals['name'] = self.pool.get('ir.sequence').get(cr, user, seq_obj_name)
|
vals['name'] = self.pool.get('ir.sequence').get(cr, user, seq_obj_name)
|
||||||
new_id = super(stock_picking, self).create(cr, user, vals, context)
|
new_id = super(stock_picking, self).create(cr, user, vals, context)
|
||||||
return new_id
|
return new_id
|
||||||
|
def _claim_count(self, cr, uid, ids, field_name, arg, context=None):
|
||||||
|
res = {}
|
||||||
|
claim = self.pool.get('crm.claim').search(cr, uid, [('ref', '=',('stock.picking.out,' + str(ids[0])))], context=context)
|
||||||
|
res[ids[0]] = len(claim)
|
||||||
|
return res
|
||||||
_columns = {
|
_columns = {
|
||||||
'name': fields.char('Reference', size=64, select=True, states={'done':[('readonly', True)], 'cancel':[('readonly',True)]}),
|
'name': fields.char('Reference', size=64, select=True, states={'done':[('readonly', True)], 'cancel':[('readonly',True)]}),
|
||||||
'origin': fields.char('Source Document', size=64, states={'done':[('readonly', True)], 'cancel':[('readonly',True)]}, help="Reference of the document", select=True),
|
'origin': fields.char('Source Document', size=64, states={'done':[('readonly', True)], 'cancel':[('readonly',True)]}, help="Reference of the document", select=True),
|
||||||
|
@ -680,6 +684,7 @@ class stock_picking(osv.osv):
|
||||||
("none", "Not Applicable")], "Invoice Control",
|
("none", "Not Applicable")], "Invoice Control",
|
||||||
select=True, required=True, readonly=True, track_visibility='onchange', states={'draft': [('readonly', False)]}),
|
select=True, required=True, readonly=True, track_visibility='onchange', states={'draft': [('readonly', False)]}),
|
||||||
'company_id': fields.many2one('res.company', 'Company', required=True, select=True, states={'done':[('readonly', True)], 'cancel':[('readonly',True)]}),
|
'company_id': fields.many2one('res.company', 'Company', required=True, select=True, states={'done':[('readonly', True)], 'cancel':[('readonly',True)]}),
|
||||||
|
'claim_count': fields.function(_claim_count, string='Claims', type='integer'),
|
||||||
}
|
}
|
||||||
_defaults = {
|
_defaults = {
|
||||||
'name': lambda self, cr, uid, context: '/',
|
'name': lambda self, cr, uid, context: '/',
|
||||||
|
@ -3122,6 +3127,8 @@ class stock_picking_out(osv.osv):
|
||||||
out_defaults = super(stock_picking_out, self).default_get(cr, uid, fields_list, context=context)
|
out_defaults = super(stock_picking_out, self).default_get(cr, uid, fields_list, context=context)
|
||||||
defaults.update(out_defaults)
|
defaults.update(out_defaults)
|
||||||
return defaults
|
return defaults
|
||||||
|
def _claim_count(self, cr, uid, ids, field_name, arg, context=None):
|
||||||
|
return super(stock_picking_out, self)._claim_count(cr, uid, ids, field_name, arg, context=context)
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
'backorder_id': fields.many2one('stock.picking.out', 'Back Order of', states={'done':[('readonly', True)], 'cancel':[('readonly',True)]}, help="If this shipment was split, then this field links to the shipment which contains the already processed part.", select=True),
|
'backorder_id': fields.many2one('stock.picking.out', 'Back Order of', states={'done':[('readonly', True)], 'cancel':[('readonly',True)]}, help="If this shipment was split, then this field links to the shipment which contains the already processed part.", select=True),
|
||||||
|
@ -3139,6 +3146,7 @@ class stock_picking_out(osv.osv):
|
||||||
* Ready to Deliver: products reserved, simply waiting for confirmation.\n
|
* Ready to Deliver: products reserved, simply waiting for confirmation.\n
|
||||||
* Delivered: has been processed, can't be modified or cancelled anymore\n
|
* Delivered: has been processed, can't be modified or cancelled anymore\n
|
||||||
* Cancelled: has been cancelled, can't be confirmed anymore"""),
|
* Cancelled: has been cancelled, can't be confirmed anymore"""),
|
||||||
|
'claim_count': fields.function(_claim_count, string='Claims', type='integer'),
|
||||||
}
|
}
|
||||||
_defaults = {
|
_defaults = {
|
||||||
'type': 'out',
|
'type': 'out',
|
||||||
|
|
Loading…
Reference in New Issue