[IMP]sale,crm,stock : Remove comments and improve kanaban view link with action
bzr revid: dbr@tinyerp.com-20120501132024-krm37io0uwrlcljb
This commit is contained in:
@@ -63,8 +63,6 @@
|
||||
|
||||
<menuitem id="menu_dashboard_acc" name="Accounting" sequence="30" parent="base.menu_reporting_dashboard" groups="group_account_user,group_account_manager"/>
|
||||
<menuitem action="open_board_account" icon="terp-graph" id="menu_board_account" parent="menu_dashboard_acc" sequence="1"/>
|
||||
<!-- <menuitem icon="terp-account" id="account.menu_finance" name="Accounting" sequence="14" action="open_board_account"/>-->
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -52,9 +52,6 @@
|
||||
<field name="view_id" ref="board_administration_form"/>
|
||||
</record>
|
||||
|
||||
<!-- bind adminitration dashboard to the root administration -->
|
||||
<!-- <menuitem id="base.menu_administration" icon="terp-administration" name="Settings" sequence="50" action="open_board_administration_form"/> -->
|
||||
|
||||
<!-- add a menu item in adminitration/reporting/dashboards -->
|
||||
<menuitem id="base.menu_reporting_admin" name="Administration" parent="base.menu_reporting_dashboard" groups="base.group_system"/>
|
||||
<menuitem id="base.menu_reporting_admin_dashboard" parent="base.menu_reporting_admin" action="open_board_administration_form"/>
|
||||
|
||||
@@ -607,7 +607,7 @@
|
||||
domain="[]"
|
||||
help="Show Sales Team"/>
|
||||
</field>
|
||||
|
||||
<field name="partner_id"/>
|
||||
<newline/>
|
||||
<group expand="0" string="Group By..." colspan="16">
|
||||
<filter string="Salesman" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}" />
|
||||
|
||||
@@ -282,6 +282,7 @@
|
||||
domain="[('user_id','=',uid)]"
|
||||
help="My Meetings" />
|
||||
</field>
|
||||
<field name="partner_id"/>
|
||||
<field name="section_id" widget="selection">
|
||||
<filter icon="terp-personal+"
|
||||
domain="['|', ('section_id.user_id','=',uid), ('section_id.member_ids', 'in', [uid])]"
|
||||
|
||||
+19
-46
@@ -25,24 +25,23 @@ from tools.translate import _
|
||||
class res_partner(osv.osv):
|
||||
""" Inherits partner and adds CRM information in the partner form """
|
||||
_inherit = 'res.partner'
|
||||
|
||||
def _total_oppo(self, cr, uid, ids, field_name, arg, context=None):
|
||||
total_oppo={}
|
||||
oppo_pool=self.pool.get('crm.lead')
|
||||
for id in ids:
|
||||
oppo_ids = oppo_pool.search(cr, uid, [('partner_id', '=', id)])
|
||||
total_oppo[id] = len(oppo_ids)
|
||||
return total_oppo
|
||||
|
||||
def _total_meeting(self, cr, uid, ids, field_name, arg, context=None):
|
||||
total_meeting={}
|
||||
def _opportunity_count(self, cr, uid, ids, field_name, arg, context=None):
|
||||
count = dict.fromkeys(ids, 0)
|
||||
opportunity_pool=self.pool.get('crm.lead')
|
||||
opportunity_ids = opportunity_pool.search(cr, uid, [('partner_id', 'in', ids)])
|
||||
for opportunity in opportunity_pool.browse(cr, uid, opportunity_ids):
|
||||
count[opportunity.partner_id.id] += 1
|
||||
return count
|
||||
|
||||
def _meeting_count(self, cr, uid, ids, field_name, arg, context=None):
|
||||
count = dict.fromkeys(ids, 0)
|
||||
meeting_pool=self.pool.get('crm.meeting')
|
||||
for id in ids:
|
||||
meeting_ids = meeting_pool.search(cr, uid, [('partner_id', '=', id)])
|
||||
total_meeting[id] = len(meeting_ids)
|
||||
return total_meeting
|
||||
|
||||
|
||||
meeting_ids = meeting_pool.search(cr, uid, [('partner_id', 'in', ids)])
|
||||
for meeting in meeting_pool.browse(cr, uid, meeting_ids):
|
||||
count[meeting.partner_id.id] += 1
|
||||
return count
|
||||
|
||||
_columns = {
|
||||
'section_id': fields.many2one('crm.case.section', 'Sales Team'),
|
||||
'opportunity_ids': fields.one2many('crm.lead', 'partner_id',\
|
||||
@@ -51,13 +50,13 @@ class res_partner(osv.osv):
|
||||
'Meetings'),
|
||||
'phonecall_ids': fields.one2many('crm.phonecall', 'partner_id',\
|
||||
'Phonecalls'),
|
||||
'total_oppo': fields.function(_total_oppo , type='integer',string="Total Opportunity"),
|
||||
'total_meeting': fields.function(_total_meeting , type='integer',string="Total Meeting"),
|
||||
'opportunity_count': fields.function(_opportunity_count , type='integer',string="Opportunity"),
|
||||
'meeting_count': fields.function(_meeting_count , type='integer',string="Meeting"),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'total_oppo': 0,
|
||||
'total_meeting': 0,
|
||||
'opportunity_count': 0,
|
||||
'meeting_count': 0,
|
||||
}
|
||||
|
||||
def redirect_partner_form(self, cr, uid, partner_id, context=None):
|
||||
@@ -75,32 +74,6 @@ class res_partner(osv.osv):
|
||||
}
|
||||
return value
|
||||
|
||||
def get_opportunity(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
models_data = self.pool.get('ir.model.data')
|
||||
|
||||
form_view = models_data.get_object_reference(cr, uid, 'crm', 'crm_case_form_view_oppor')
|
||||
tree_view = models_data.get_object_reference(cr, uid, 'crm', 'crm_case_tree_view_oppor')
|
||||
search_view = models_data.get_object_reference(cr, uid, 'crm', 'view_crm_case_opportunities_filter')
|
||||
partner_id = self.browse(cr, uid, ids[0], context=context)
|
||||
domain =[('partner_id', '=', partner_id.id)]
|
||||
|
||||
return {
|
||||
'name': _('Opportunity'),
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree, form',
|
||||
'res_model': 'crm.lead',
|
||||
'domain': domain,
|
||||
'view_id': False,
|
||||
'views': [(tree_view and tree_view[1] or False, 'tree'),
|
||||
(form_view and form_view[1] or False, 'form'),
|
||||
(False, 'calendar'), (False, 'graph')],
|
||||
'type': 'ir.actions.act_window',
|
||||
'search_view_id': search_view and search_view[1] or False,
|
||||
'nodestroy': True,
|
||||
}
|
||||
|
||||
def make_opportunity(self, cr, uid, ids, opportunity_summary, planned_revenue=0.0, probability=0.0, partner_id=None, context=None):
|
||||
categ_obj = self.pool.get('crm.case.categ')
|
||||
categ_ids = categ_obj.search(cr, uid, [('object_id.model','=','crm.lead')])
|
||||
|
||||
@@ -42,8 +42,24 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Partner kanban view inherte -->
|
||||
<act_window
|
||||
id="crm_meeting_partner"
|
||||
name="Meetings"
|
||||
res_model="crm.meeting"
|
||||
src_model="res.partner"
|
||||
view_mode="calendar,tree,form,gantt"
|
||||
context="{'search_default_partner_id': [active_id],'default_partner_id': active_id}"
|
||||
/>
|
||||
<act_window
|
||||
context="{'search_default_partner_id': [active_id],'default_partner_id': active_id}"
|
||||
id="act_res_partner_2_opportunity"
|
||||
name="Opportunity"
|
||||
view_mode="tree,form,graph,calendar"
|
||||
domain="[('type','=','opportunity')]"
|
||||
res_model="crm.lead"
|
||||
src_model="res.partner"/>
|
||||
|
||||
<!-- Partner kanban view inherte -->
|
||||
<record model="ir.ui.view" id="crm_lead_partner_kanban_view">
|
||||
<field name="name">res.partner.kanban.inherit</field>
|
||||
<field name="model">res.partner</field>
|
||||
@@ -53,18 +69,15 @@
|
||||
<field name="mobile" position="after">
|
||||
<field name="opportunity_ids"/>
|
||||
<field name="meeting_ids"/>
|
||||
<field name="total_oppo"/>
|
||||
<field name="total_meeting"/>
|
||||
<field name="opportunity_count"/>
|
||||
<field name="meeting_count"/>
|
||||
</field>
|
||||
<xpath expr="//div[@class='oe_partner_desc']//h4[@class='oe_partner_heading']" position="after">
|
||||
<a name="get_opportunity" type="object">
|
||||
<t t-if="record.total_oppo.value <= 1">Opportunity(<t t-esc="record.total_oppo.value"/>)</t>
|
||||
<t t-if="record.total_oppo.value > 1">Opportunities(<t t-esc="record.total_oppo.value"/>)</t>
|
||||
<a name="%(act_res_partner_2_opportunity)d" type="action">
|
||||
<t t-if="record.opportunity_count.value">Opportunities(<t t-esc="record.opportunity_count.value"/>)</t>
|
||||
</a>
|
||||
<a name="%(crm.crm_case_categ_meet)d" type="action">
|
||||
<t t-if="record.total_meeting.value <= 1">Meeting(<t t-esc="record.total_meeting.value"/>)</t>
|
||||
<t t-if="record.total_meeting.value > 1">Meetings(<t t-esc="record.total_meeting.value"/>)</t>
|
||||
|
||||
<a name="%(crm_meeting_partner)d" type="action">
|
||||
<t t-if="record.meeting_count.value">Meetings(<t t-esc="record.meeting_count.value"/>)</t>
|
||||
</a>
|
||||
</xpath>
|
||||
</field>
|
||||
|
||||
@@ -49,9 +49,6 @@
|
||||
id="menu_reports_document_manager"
|
||||
icon="terp-graph"/>
|
||||
|
||||
<!-- <menuitem name="Knowledge" icon="terp-stock" id="knowledge.menu_document"
|
||||
sequence="19" groups="base.group_system,base.group_document_user" action="open_board_document_manager"/> -->
|
||||
|
||||
<record model="ir.ui.view" id="board_document_manager_form1">
|
||||
<field name="name">board.document.manager.form1</field>
|
||||
<field name="model">board.board</field>
|
||||
|
||||
@@ -51,7 +51,5 @@
|
||||
<field name="view_id" ref="board_hr_manager_form"/>
|
||||
</record>
|
||||
|
||||
<!--<menuitem id="menu_hr_dashboard_manager" parent="menu_hr_dashboard" icon="terp-graph" action="open_board_hr_manager" groups="base.group_hr_manager" sequence="5"/>-->
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -35,9 +35,5 @@
|
||||
id="menu_board_manufacturing" parent="menus_dash_mrp"
|
||||
sequence="1"/>
|
||||
|
||||
<!-- <menuitem icon="terp-mrp" id="base.menu_mrp_root" name="Manufacturing" sequence="8"
|
||||
action="open_board_manufacturing"/> -->
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -117,9 +117,5 @@
|
||||
parent="menu_project_dashboard"
|
||||
sequence="1"/>
|
||||
|
||||
<!-- <menuitem
|
||||
icon="terp-project" id="base.menu_main_pm"
|
||||
name="Project" sequence="10" action="open_board_project"/> -->
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -116,8 +116,5 @@
|
||||
parent="menu_purchase_deshboard"
|
||||
sequence="4"/>
|
||||
|
||||
<!-- <menuitem icon="terp-purchase" id="base.menu_purchase_root" action="open_board_purchase" name="Purchases"/> -->
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -124,9 +124,5 @@
|
||||
<field name="view_id" ref="board_sales_form"/>
|
||||
</record>
|
||||
|
||||
<!-- <menuitem
|
||||
id="base.menu_base_partner" action="open_board_sales"
|
||||
name="Sales"/> -->
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -25,18 +25,18 @@ from tools.translate import _
|
||||
class res_partner(osv.osv):
|
||||
_inherit = 'res.partner'
|
||||
|
||||
def _total_sale(self, cr, uid, ids, field_name, arg, context=None):
|
||||
total_sale={}
|
||||
sale_pool=self.pool.get('sale.order')
|
||||
for id in ids:
|
||||
sale_ids = sale_pool.search(cr, uid, [('partner_id', '=', id)])
|
||||
total_sale[id] = len(sale_ids)
|
||||
return total_sale
|
||||
def _sale_order_count(self, cr, uid, ids, field_name, arg, context=None):
|
||||
count = dict.fromkeys(ids, 0)
|
||||
sale_order_pool=self.pool.get('sale.order')
|
||||
sale_order_ids = sale_order_pool.search(cr, uid, [('partner_id', 'in', ids)])
|
||||
for sale_order in sale_order_pool.browse(cr, uid, sale_order_ids):
|
||||
count[sale_order.partner_id.id] += 1
|
||||
return count
|
||||
|
||||
_columns = {
|
||||
'total_sale': fields.function(_total_sale , type='integer',string="Total Sale"),
|
||||
'sale_order_count': fields.function(_sale_order_count , type='integer',string="Sale Order"),
|
||||
}
|
||||
_defaults = {
|
||||
'total_sale': 0,
|
||||
'sale_order_count': 0,
|
||||
}
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -9,12 +9,11 @@
|
||||
<field name="inherit_id" ref="base.res_partner_kanban_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="mobile" position="after">
|
||||
<field name="total_sale"/>
|
||||
<field name="sale_order_count"/>
|
||||
</field>
|
||||
<xpath expr="//div[@class='oe_partner_desc']//h4[@class='oe_partner_heading']" position="after">
|
||||
<a name="%(sale.act_res_partner_2_sale_order)d" type="action">
|
||||
<t t-if="record.total_sale.value <= 1">Quotation(<t t-esc="record.total_sale.value" />)</t>
|
||||
<t t-if="record.total_sale.value > 1">Quotations(<t t-esc="record.total_sale.value" />)</t>
|
||||
<t t-if="record.sale_order_count.value">Quotations(<t t-esc="record.sale_order_count.value" />)</t>
|
||||
</a>
|
||||
</xpath>
|
||||
</field>
|
||||
|
||||
@@ -70,7 +70,6 @@
|
||||
|
||||
<menuitem id="menu_dashboard_stock" name="Warehouse" sequence="10" parent="base.menu_reporting_dashboard"/>
|
||||
<menuitem action="open_board_warehouse" icon="terp-graph" groups="group_stock_manager" id="menu_board_warehouse" parent="menu_dashboard_stock" sequence="1"/>
|
||||
<!-- <menuitem icon="terp-stock" id="stock.menu_stock_root" name="Warehouse" sequence="5" groups="group_stock_manager" action="open_board_warehouse"/>-->
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
Reference in New Issue
Block a user