[IMP] convert button into stat button for products
bzr revid: rma@tinyerp.com-20140324135621-13t191kmnn6t22jk
This commit is contained in:
parent
0f40b3bc8f
commit
96ea9392aa
|
@ -114,6 +114,19 @@ class sale_order_line(osv.osv):
|
|||
if rec:
|
||||
inv_line_obj.write(cr, uid, [line.id], {'account_analytic_id': rec.analytic_id.id}, context=context)
|
||||
return create_ids
|
||||
|
||||
class product_product(osv.Model):
|
||||
_inherit = 'product.product'
|
||||
def _rules_count(self, cr, uid, ids, field_name, arg, context=None):
|
||||
res = dict(map(lambda x: (x,0), ids))
|
||||
try:
|
||||
for rule in self.browse(cr, uid, ids, context=context):
|
||||
res[rule.id] = len(rule.rules_ids)
|
||||
except:
|
||||
pass
|
||||
return res
|
||||
_columns = {
|
||||
'rules_ids': fields.one2many('account.analytic.default', 'product_id', 'Analytic Rules '),
|
||||
'rules_count': fields.function(_rules_count, string='# Analytic Rules', type='integer'),
|
||||
}
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -80,7 +80,10 @@
|
|||
<field name="inherit_id" ref="product.product_normal_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//div[@name='buttons']" position="inside">
|
||||
<button string="Analytic Rules" name= "%(action_product_default_list)d" type="action" groups="analytic.group_analytic_accounting" />
|
||||
<button class="oe_inline oe_stat_button" name= "%(action_product_default_list)d" type="action"
|
||||
groups="analytic.group_analytic_accounting" icon="fa-xing">
|
||||
<field string="Analytic Rules" name="rules_count" widget="statinfo" />
|
||||
</button>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
|
|
@ -81,10 +81,14 @@
|
|||
<page string="Accounting" position="before" version="7.0">
|
||||
<page string="Payment Follow-up" groups="account.group_account_invoice" name="followup_tab">
|
||||
<div class="oe_right oe_button_box" name="followup_button">
|
||||
<button name="do_button_print" type="object" string="Print Overdue Payments" groups="account.group_account_user"
|
||||
help="Print overdue payments report independent of follow-up line" attrs="{'invisible':[('payment_amount_due', '<=', 0.0)]}" />
|
||||
<button name="do_partner_mail" type="object" string="Send Overdue Email" groups="account.group_account_user"
|
||||
help="If not specified by the latest follow-up level, it will send from the default email template" attrs="{'invisible':[('payment_amount_due', '<=', 0.0)]}"/>
|
||||
<button class="oe_inline oe_stat_button" type="object" name="do_button_print"
|
||||
icon="fa-mail" string="Print Overdue Payments" widget="statinfo" groups="account.group_account_user"
|
||||
help="Print overdue payments report independent of follow-up line"
|
||||
attrs="{'invisible':[('payment_amount_due', '<=', 0.0)]}"/>
|
||||
<button class="oe_inline oe_stat_button" type="object" name="do_partner_mail"
|
||||
icon="fa-print" string="Send Overdue Email" widget="statinfo"
|
||||
help="If not specified by the latest follow-up level, it will send from the default email template"
|
||||
attrs="{'invisible':[('payment_amount_due', '<=', 0.0)]}" groups="account.group_account_user"/>
|
||||
</div>
|
||||
<p attrs="{'invisible':[('latest_followup_date','=', False)]}">
|
||||
The <field name="latest_followup_date" class = "oe_inline"/>, the latest payment follow-up
|
||||
|
|
|
@ -31,6 +31,15 @@ class crm_phonecall(osv.osv):
|
|||
_description = "Phonecall"
|
||||
_order = "id desc"
|
||||
_inherit = ['mail.thread']
|
||||
|
||||
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.meeting_ids)
|
||||
except:
|
||||
pass
|
||||
return res
|
||||
_columns = {
|
||||
'date_action_last': fields.datetime('Last Action', readonly=1),
|
||||
'date_action_next': fields.datetime('Next Action', readonly=1),
|
||||
|
@ -65,6 +74,8 @@ class crm_phonecall(osv.osv):
|
|||
'date_closed': fields.datetime('Closed', readonly=True),
|
||||
'date': fields.datetime('Date'),
|
||||
'opportunity_id': fields.many2one ('crm.lead', 'Lead/Opportunity'),
|
||||
'meeting_ids': fields.one2many('calendar.event', 'phonecall_id', 'Phonecalls'),
|
||||
'meeting_count': fields.function(_meeting_count, string='# Meetings', type='integer'),
|
||||
}
|
||||
|
||||
def _get_default_state(self, cr, uid, context=None):
|
||||
|
|
|
@ -64,15 +64,15 @@
|
|||
<field name="state" nolabel="1" widget="statusbar" clickable="True"/>
|
||||
</header>
|
||||
<sheet string="Phone Call">
|
||||
<div class="oe_right">
|
||||
<button string="Convert to Opportunity"
|
||||
type="object"
|
||||
name="action_button_convert2opportunity"
|
||||
attrs="{'invisible':[ '|', ('opportunity_id','!=',False), ('state', 'not in', ('open', 'done'))]}"/>
|
||||
<button string="Schedule Other Call"
|
||||
name="%(phonecall_to_phonecall_act)d"
|
||||
type="action"/>
|
||||
<button string="Schedule a Meeting" name="action_make_meeting" type="object"/>
|
||||
<div class="oe_right oe_button_box">
|
||||
<button class="oe_inline oe_stat_button" type="object" name="action_button_convert2opportunity"
|
||||
icon="fa fa-star fa-fw" string="Convert to Opportunity"
|
||||
attrs="{'invisible':[ '|', ('opportunity_id','!=',False), ('state', 'not in', ('open', 'done'))]}" widget="statinfo"/>
|
||||
<button class="oe_inline oe_stat_button" type="action"
|
||||
name="%(phonecall_to_phonecall_act)d" icon="fa-phone fa-fw" string="Schedule Other Call" widget="statinfo"/>
|
||||
<button class="oe_inline oe_stat_button" name="action_make_meeting" type="object" icon="fa-calendar fa-fw">
|
||||
<field string="Schedule a Meeting" name="meeting_count" widget="statinfo" />
|
||||
</button>
|
||||
</div>
|
||||
<div class="oe_title">
|
||||
<div class="oe_edit_only">
|
||||
|
|
|
@ -118,10 +118,8 @@
|
|||
<label for="use_timesheets"/>
|
||||
</xpath>
|
||||
<xpath expr='//div[@name="buttons"]' position='inside'>
|
||||
<button string="Costs and Revenues"
|
||||
name="%(act_analytic_cost_revenue)d"
|
||||
type="action"/>
|
||||
|
||||
<button class="oe_inline oe_stat_button" type="action" name="%(act_analytic_cost_revenue)d"
|
||||
icon="fa-suitcase" string="Costs and Revenues" widget="statinfo"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
|
|
@ -1111,8 +1111,24 @@ class mrp_production_product_line(osv.osv):
|
|||
|
||||
class product_product(osv.osv):
|
||||
_inherit = "product.product"
|
||||
def _bom_count(self, cr, uid, ids, field_name, arg, context=None):
|
||||
res = dict(map(lambda x: (x,{'bom_count': 0, 'mo_count': 0, 'bom_strct':0}), ids))
|
||||
try:
|
||||
for bom in self.browse(cr, uid, ids, context=context):
|
||||
res[bom.id] = {
|
||||
'bom_count': len(bom.bom_ids),
|
||||
'mo_count': len(bom.mo_ids),
|
||||
'bom_strct':len(bom.bom_ids),
|
||||
}
|
||||
except:
|
||||
pass
|
||||
return res
|
||||
_columns = {
|
||||
'bom_ids': fields.one2many('mrp.bom', 'product_id', 'Bill of Materials'),
|
||||
'mo_ids': fields.one2many('mrp.production', 'product_id', 'Manufacturing Orders'),
|
||||
'bom_count': fields.function(_bom_count, string='# Bill of Material', type='integer', multi="bom_count"),
|
||||
'bom_strct': fields.function(_bom_count, string='# Bill of Material Structure', type='integer', multi="bom_count"),
|
||||
'mo_count': fields.function(_bom_count, string='# Manufacturing Orders', type='integer', multi="bom_count"),
|
||||
}
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -1040,9 +1040,18 @@
|
|||
<field name="inherit_id" ref="product.product_normal_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//div[@name='buttons']" position="inside">
|
||||
<button string="Bill of Materials" name="%(product_open_bom)d" type="action" attrs="{'invisible':[('type', '=', 'service')]}"/>
|
||||
<button string="BoM Structure" name="%(act_product_mrp_bom_open)d" type="action" groups="mrp.group_mrp_user" attrs="{'invisible':[('type', '=', 'service')]}"/>
|
||||
<button string="Manufacturing Orders" name="%(act_product_mrp_production)d" type="action" groups="mrp.group_mrp_user" attrs="{'invisible':[('type', '=', 'service')]}"/>
|
||||
<button class="oe_inline oe_stat_button" name="%(product_open_bom)d" type="action"
|
||||
groups="mrp.group_mrp_user" attrs="{'invisible':[('type', '=', 'service')]}" icon="fa-flask">
|
||||
<field string="Bill of Materials" name="bom_count" widget="statinfo" />
|
||||
</button>
|
||||
<button class="oe_inline oe_stat_button" name="%(act_product_mrp_bom_open)d" type="action"
|
||||
groups="mrp.group_mrp_user" attrs="{'invisible':[('type', '=', 'service')]}" icon="fa-flask">
|
||||
<field string="BoM Structure" name="bom_strct" widget="statinfo" />
|
||||
</button>
|
||||
<button class="oe_inline oe_stat_button" name="%(act_product_mrp_production)d" type="action"
|
||||
groups="mrp.group_mrp_user" attrs="{'invisible':[('type', '=', 'service')]}" icon="fa-pencil-square-o">
|
||||
<field string="Manufacturing Orders" name="mo_count" widget="statinfo" />
|
||||
</button>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
|
|
@ -613,8 +613,17 @@ class product_template(osv.osv):
|
|||
|
||||
class product_product(osv.osv):
|
||||
_inherit="product.product"
|
||||
def _orderpoint_count(self, cr, uid, ids, field_name, arg, context=None):
|
||||
res = dict(map(lambda x: (x,0), ids))
|
||||
try:
|
||||
for orderpoint in self.browse(cr, uid, ids, context=context):
|
||||
res[orderpoint.id] = len(orderpoint.orderpoint_ids)
|
||||
except:
|
||||
pass
|
||||
return res
|
||||
_columns = {
|
||||
'orderpoint_ids': fields.one2many('stock.warehouse.orderpoint', 'product_id', 'Minimum Stock Rules'),
|
||||
'orderpoint_count': fields.function(_orderpoint_count, string='# Orderpoints', type='integer'),
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -357,7 +357,10 @@
|
|||
<button string="⇒ Request Procurement" name="%(act_make_procurement)d" type="action" class="oe_link"/>
|
||||
</xpath>
|
||||
<xpath expr="//div[@name='buttons']" position="inside">
|
||||
<button string="Orderpoints" name="%(product_open_orderpoint)d" type="action" attrs="{'invisible':[('type', '=', 'service')]}"/>
|
||||
<button class="oe_inline oe_stat_button" name="%(product_open_orderpoint)d" type="action"
|
||||
attrs="{'invisible':[('type', '=', 'service')]}" icon="fa-pinterest">
|
||||
<field string="Orderpoints" name="orderpoint_count" widget="statinfo" />
|
||||
</button>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='cost_method']" position="before">
|
||||
<field name="procure_method" groups="base.group_user"
|
||||
|
|
|
@ -1263,8 +1263,19 @@ class mail_mail(osv.Model):
|
|||
class product_template(osv.Model):
|
||||
_name = 'product.template'
|
||||
_inherit = 'product.template'
|
||||
|
||||
def _purchase_count(self, cr, uid, ids, field_name, arg, context=None):
|
||||
res = dict(map(lambda x: (x,0), ids))
|
||||
try:
|
||||
for purchase in self.browse(cr, uid, ids, context=context):
|
||||
res[purchase.id] = len(purchase.purchase_ids)
|
||||
except:
|
||||
pass
|
||||
return res
|
||||
_columns = {
|
||||
'purchase_ok': fields.boolean('Can be Purchased', help="Specify if the product can be selected in a purchase order line."),
|
||||
'purchase_ids': fields.one2many('purchase.order', 'product_id', 'Purchases'),
|
||||
'purchase_count': fields.function(_purchase_count, string='# Purchases', type='integer'),
|
||||
}
|
||||
_defaults = {
|
||||
'purchase_ok': 1,
|
||||
|
|
|
@ -631,7 +631,10 @@
|
|||
<field name="inherit_id" ref="account.product_normal_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//div[@name='buttons']" position="inside">
|
||||
<button string="Purchases" name="%(action_purchase_line_product_tree)d" type="action" groups="purchase.group_purchase_user"/>
|
||||
<button class="oe_inline oe_stat_button" name="%(action_purchase_line_product_tree)d" type="action"
|
||||
groups="purchase.group_purchase_user" icon="fa-money">
|
||||
<field string="Purchases" name="purchase_count" widget="statinfo" />
|
||||
</button>
|
||||
</xpath>
|
||||
<field name="property_account_expense" position="replace" >
|
||||
<field name="property_account_expense" domain="[('type','<>','view'),('type','<>','consolidation')]" attrs="{'readonly':[('purchase_ok','=',0)]}" groups="account.group_account_user"/>
|
||||
|
|
|
@ -1024,4 +1024,18 @@ class account_invoice(osv.Model):
|
|||
workflow.trg_validate(uid, 'account.invoice', id, 'invoice_cancel', cr)
|
||||
return super(account_invoice, self).unlink(cr, uid, ids, context=context)
|
||||
|
||||
class product_product(osv.Model):
|
||||
_inherit = 'product.product'
|
||||
def _sales_count(self, cr, uid, ids, field_name, arg, context=None):
|
||||
res = dict(map(lambda x: (x,0), ids))
|
||||
try:
|
||||
for sale in self.browse(cr, uid, ids, context=context):
|
||||
res[sale.id] = len(sale.sales_ids)
|
||||
except:
|
||||
pass
|
||||
return res
|
||||
_columns = {
|
||||
'sales_ids': fields.one2many('sale.order.line', 'product_id', 'Sales '),
|
||||
'sales_count': fields.function(_sales_count, string='# Sales', type='integer'),
|
||||
}
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -499,7 +499,10 @@
|
|||
<field name="inherit_id" ref="product.product_normal_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//div[@name='buttons']" position="inside">
|
||||
<button string="Sales" name="%(action_order_line_product_tree)d" type="action" groups="base.group_sale_salesman"/>
|
||||
<button class="oe_inline oe_stat_button" name="%(action_order_line_product_tree)d"
|
||||
type="action" groups="base.group_sale_salesman" icon="fa-strikethrough">
|
||||
<field string="Sales" name="sales_count" widget="statinfo" />
|
||||
</button>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
|
|
@ -352,7 +352,14 @@ class product_product(osv.osv):
|
|||
for id in ids:
|
||||
res[id][f] = stock.get(id, 0.0)
|
||||
return res
|
||||
|
||||
def _move_count(self, cr, uid, ids, field_name, arg, context=None):
|
||||
res = dict(map(lambda x: (x,0), ids))
|
||||
try:
|
||||
for move in self.browse(cr, uid, ids, context=context):
|
||||
res[move.id] = len(move.move_ids)
|
||||
except:
|
||||
pass
|
||||
return res
|
||||
_columns = {
|
||||
'reception_count': fields.function(_stock_move_count, string="Reception", type='integer', multi='pickings'),
|
||||
'delivery_count': fields.function(_stock_move_count, string="Delivery", type='integer', multi='pickings'),
|
||||
|
@ -413,6 +420,8 @@ class product_product(osv.osv):
|
|||
help="If real-time valuation is enabled for a product, the system will automatically write journal entries corresponding to stock moves." \
|
||||
"The inventory variation account set on the product category will represent the current inventory value, and the stock input and stock output account will hold the counterpart moves for incoming and outgoing products."
|
||||
, required=True),
|
||||
'move_ids': fields.one2many('stock.move', 'product_id', 'Moves'),
|
||||
'move_count': fields.function(_move_count, string='# Moves', type='integer'),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
|
|
|
@ -73,8 +73,14 @@
|
|||
<field name="inherit_id" ref="product.product_normal_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//div[@name='buttons']" position="inside">
|
||||
<button string="Inventory" name="%(action_product_location_tree)d" type="action" attrs="{'invisible':[('type', '=', 'service')]}" groups="stock.group_locations"/>
|
||||
<button string="Moves" name= "%(act_product_stock_move_open)d" type="action" attrs="{'invisible':[('type', '=', 'service')]}" groups="stock.group_stock_user"/>
|
||||
<button class="oe_inline oe_stat_button"
|
||||
name="%(action_product_location_tree)d" type="action"
|
||||
attrs="{'invisible':[('type', '=', 'service')]}" groups="stock.group_locations" icon="fa-files-o" string="Inventory" />
|
||||
<button class="oe_inline oe_stat_button" name= "%(act_product_stock_move_open)d" type="action"
|
||||
attrs="{'invisible':[('type', '=', 'service')]}" groups="stock.group_stock_user" icon="fa-exchange">
|
||||
<field string="Moves" name="move_count" widget="statinfo"/>
|
||||
</button>
|
||||
|
||||
</xpath>
|
||||
<group name="procurement_uom" position="before">
|
||||
<group name="delay" string="Delays">
|
||||
|
|
Loading…
Reference in New Issue