[MERGE]: merging from a trunk addons
bzr revid: mga@tinyerp.com-20100921131839-162e6kcyl6m8rawq
This commit is contained in:
@@ -15,15 +15,6 @@
|
||||
name: Voucher Axelor
|
||||
period_id: account.period_6
|
||||
|
||||
-
|
||||
In order to test the PDF reports defined on a account_voucher, we will print account voucher amount Report
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
import netsvc, tools, os
|
||||
(data, format) = netsvc.LocalService('report.voucher.cash_amount').create(cr, uid, [ref("account_voucher_voucheraxelor0")], {}, {})
|
||||
if tools.config['test_report_directory']:
|
||||
file(os.path.join(tools.config['test_report_directory'], 'account_voucher-amount.'+format), 'wb+').write(data)
|
||||
|
||||
-
|
||||
In order to test the PDF reports defined on a account_voucher, we will print account voucher Report
|
||||
-
|
||||
|
||||
@@ -85,7 +85,6 @@ Create dashboard for CRM that includes:
|
||||
|
||||
'wizard/crm_send_email_view.xml',
|
||||
'wizard/crm_add_note_view.xml',
|
||||
'wizard/crm_forward_to_partner_view.xml',
|
||||
'wizard/crm_merge_opportunities_view.xml',
|
||||
|
||||
'crm_view.xml',
|
||||
|
||||
@@ -218,9 +218,6 @@
|
||||
name="%(crm.action_crm_send_mail)d"
|
||||
context="{'mail':'new', 'model': 'crm.lead'}"
|
||||
icon="terp-mail-message-new" type="action" />
|
||||
<button string="Forward"
|
||||
name="%(crm_lead_forward_to_partner_act)d"
|
||||
icon="terp-mail-forward" type="action" />
|
||||
</page>
|
||||
</notebook>
|
||||
</form>
|
||||
|
||||
@@ -174,9 +174,6 @@
|
||||
name="%(crm.action_crm_send_mail)d"
|
||||
context="{'mail':'new', 'model': 'crm.lead'}"
|
||||
icon="terp-mail-message-new" type="action" />
|
||||
<button string="Forward"
|
||||
name="%(crm_lead_forward_to_partner_act)d"
|
||||
icon="terp-mail-forward" type="action" />
|
||||
</page>
|
||||
<page string="Extra Info" groups="base.group_extended">
|
||||
<group col="2" colspan="2">
|
||||
|
||||
@@ -576,9 +576,6 @@
|
||||
name="%(crm.action_crm_send_mail)d"
|
||||
context="{'mail':'new', 'model': 'crm.case.custom'}"
|
||||
icon="terp-mail-message-new" type="action" />
|
||||
<button string="Forward to Partner"
|
||||
name="%(crm_lead_forward_to_partner_act)d"
|
||||
icon="terp-mail-forward" type="action" />
|
||||
</page>
|
||||
</notebook>
|
||||
</form>
|
||||
|
||||
@@ -20,3 +20,5 @@
|
||||
##############################################################################
|
||||
|
||||
import partner_geo_assign
|
||||
import wizard
|
||||
import report
|
||||
|
||||
@@ -32,8 +32,9 @@ based on geolocalization.
|
||||
'depends': ['crm'],
|
||||
'update_xml': [
|
||||
'res_partner_view.xml',
|
||||
'crm_lead_view.xml',
|
||||
'wizard/crm_forward_to_partner_view.xml',
|
||||
'crm_lead_view.xml',
|
||||
'report/crm_lead_report_view.xml',
|
||||
],
|
||||
'installable': True,
|
||||
'active': False,
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<page string="Assignation" groups="base.group_extended">
|
||||
<group name="partner_assign_group" col="5" colspan="4">
|
||||
<separator string="Partner Assignation" colspan="5"/>
|
||||
<field name="partner_assigned_id" on_change="onchange_assign_id(partner_assigned_id)" domain="[('partner_weight','>',0)]"/>
|
||||
<field name="partner_assigned_id" on_change="onchange_assign_id(partner_assigned_id)" domain="[('grade_id','<>',False)]"/>
|
||||
<field name="date_assign"/>
|
||||
<group colspan="1" col="1">
|
||||
<button string="Forward"
|
||||
|
||||
@@ -41,6 +41,20 @@ def geo_find(addr):
|
||||
_('Could not contact geolocation servers, please make sure you have a working internet connection (%s)') % e)
|
||||
|
||||
|
||||
class res_partner_grade(osv.osv):
|
||||
_order = 'sequence'
|
||||
_name = 'res.partner.grade'
|
||||
_columns = {
|
||||
'sequence': fields.integer('Sequence'),
|
||||
'active': fields.boolean('Active'),
|
||||
'name': fields.char('Grade Name', size=32)
|
||||
}
|
||||
_defaults = {
|
||||
'active': lambda *args: 1
|
||||
}
|
||||
res_partner_grade()
|
||||
|
||||
|
||||
class res_partner(osv.osv):
|
||||
_inherit = "res.partner"
|
||||
_columns = {
|
||||
@@ -51,6 +65,7 @@ class res_partner(osv.osv):
|
||||
help="Gives the probability to assign a lead to this partner. (0 means no assignation.)"),
|
||||
'opportunity_assigned_ids': fields.one2many('crm.lead', 'partner_assigned_id',\
|
||||
'Assigned Opportunities'),
|
||||
'grade_id': fields.many2one('res.partner.grade', 'Partner Grade')
|
||||
}
|
||||
_defaults = {
|
||||
'partner_weight': lambda *args: 0
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import crm_lead_report
|
||||
|
||||
@@ -0,0 +1,128 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import fields,osv
|
||||
import tools
|
||||
from crm import crm
|
||||
|
||||
AVAILABLE_STATES = [
|
||||
('draft','Draft'),
|
||||
('open','Open'),
|
||||
('cancel', 'Cancelled'),
|
||||
('done', 'Closed'),
|
||||
('pending','Pending')
|
||||
]
|
||||
|
||||
class crm_lead_report_assign(osv.osv):
|
||||
""" CRM Lead Report """
|
||||
_name = "crm.lead.report.assign"
|
||||
_auto = False
|
||||
_description = "CRM Lead Report"
|
||||
_columns = {
|
||||
'name': fields.char('Year', size=64, required=False, readonly=True),
|
||||
'partner_assigned_id':fields.many2one('res.partner', 'Partner', readonly=True),
|
||||
'grade_id':fields.many2one('res.partner.grade', 'Grade', readonly=True),
|
||||
'user_id':fields.many2one('res.users', 'User', readonly=True),
|
||||
'country_id':fields.many2one('res.country', 'Country', readonly=True),
|
||||
'section_id':fields.many2one('crm.case.section', 'Section', readonly=True),
|
||||
'state': fields.selection(AVAILABLE_STATES, 'State', size=16, readonly=True),
|
||||
'month':fields.selection([('01', 'January'), ('02', 'February'), \
|
||||
('03', 'March'), ('04', 'April'),\
|
||||
('05', 'May'), ('06', 'June'), \
|
||||
('07', 'July'), ('08', 'August'),\
|
||||
('09', 'September'), ('10', 'October'),\
|
||||
('11', 'November'), ('12', 'December')], 'Month', readonly=True),
|
||||
'company_id': fields.many2one('res.company', 'Company', readonly=True),
|
||||
'partner_date': fields.date('Partner Date', readonly=True),
|
||||
'create_date': fields.datetime('Create Date', readonly=True),
|
||||
'day': fields.char('Day', size=128, readonly=True),
|
||||
'delay_open': fields.float('Delay to Open',digits=(16,2),readonly=True, group_operator="avg",help="Number of Days to open the case"),
|
||||
'delay_close': fields.float('Delay to Close',digits=(16,2),readonly=True, group_operator="avg",help="Number of Days to close the case"),
|
||||
'delay_expected': fields.float('Overpassed Deadline',digits=(16,2),readonly=True, group_operator="avg"),
|
||||
'probability': fields.float('Avg Probability',digits=(16,2),readonly=True, group_operator="avg"),
|
||||
'probability_max': fields.float('Max Probability',digits=(16,2),readonly=True, group_operator="max"),
|
||||
'planned_revenue': fields.float('Planned Revenue',digits=(16,2),readonly=True),
|
||||
'probable_revenue': fields.float('Probable Revenue', digits=(16,2),readonly=True),
|
||||
'categ_id': fields.many2one('crm.case.categ', 'Category',\
|
||||
domain="[('section_id','=',section_id),\
|
||||
('object_id.model', '=', 'crm.lead')]" , readonly=True),
|
||||
'stage_id': fields.many2one ('crm.case.stage', 'Stage', \
|
||||
domain="[('section_id','=',section_id),\
|
||||
('object_id.model', '=', 'crm.lead')]", readonly=True),
|
||||
'partner_id': fields.many2one('res.partner', 'Customer' , readonly=True),
|
||||
'opening_date': fields.date('Opening Date', readonly=True),
|
||||
'creation_date': fields.date('Creation Date', readonly=True),
|
||||
'date_closed': fields.date('Close Date', readonly=True),
|
||||
'nbr': fields.integer('# of Cases', readonly=True),
|
||||
'company_id': fields.many2one('res.company', 'Company', readonly=True),
|
||||
'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority'),
|
||||
'type':fields.selection([
|
||||
('lead','Lead'),
|
||||
('opportunity','Opportunity'),
|
||||
],'Type', help="Type is used to separate Leads and Opportunities"),
|
||||
}
|
||||
def init(self, cr):
|
||||
|
||||
"""
|
||||
CRM Lead Report
|
||||
@param cr: the current row, from the database cursor
|
||||
"""
|
||||
tools.drop_view_if_exists(cr, 'crm_lead_report')
|
||||
cr.execute("""
|
||||
CREATE OR REPLACE VIEW crm_lead_report_assign AS (
|
||||
SELECT
|
||||
c.id,
|
||||
to_char(c.create_date, 'YYYY') as name,
|
||||
to_char(c.create_date, 'MM') as month,
|
||||
to_char(c.create_date, 'YYYY-MM-DD') as day,
|
||||
to_char(c.create_date, 'YYYY-MM-DD') as creation_date,
|
||||
to_char(c.date_open, 'YYYY-MM-DD') as opening_date,
|
||||
to_char(c.date_closed, 'YYYY-mm-dd') as date_closed,
|
||||
c.state,
|
||||
c.user_id,
|
||||
c.probability,
|
||||
c.probability as probability_max,
|
||||
c.stage_id,
|
||||
c.type,
|
||||
c.company_id,
|
||||
c.priority,
|
||||
c.section_id,
|
||||
c.categ_id,
|
||||
c.partner_id,
|
||||
c.country_id,
|
||||
c.planned_revenue,
|
||||
c.partner_assigned_id,
|
||||
p.grade_id,
|
||||
p.date as partner_date,
|
||||
c.planned_revenue*(c.probability/100) as probable_revenue,
|
||||
1 as nbr,
|
||||
date_trunc('day',c.create_date) as create_date,
|
||||
extract('epoch' from (c.date_closed-c.create_date))/(3600*24) as delay_close,
|
||||
extract('epoch' from (c.date_deadline - c.date_closed))/(3600*24) as delay_expected,
|
||||
extract('epoch' from (c.date_open-c.create_date))/(3600*24) as delay_open
|
||||
FROM
|
||||
crm_lead c
|
||||
left join res_partner p on (c.partner_assigned_id=p.id)
|
||||
)""")
|
||||
|
||||
crm_lead_report_assign()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -0,0 +1,148 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- Opportunity tree view -->
|
||||
<record id="view_report_crm_lead_assign_filter" model="ir.ui.view">
|
||||
<field name="name">crm.lead.report.assign.select</field>
|
||||
<field name="model">crm.lead.report.assign</field>
|
||||
<field name="type">search</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Leads Analysis">
|
||||
<group col="20" colspan="8">
|
||||
<filter string="Last 30 Days" icon="terp-go-month" name="this_month"
|
||||
domain="[('create_date','>',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]"/>
|
||||
<filter icon="terp-go-week" string="7 Days" separator="1"
|
||||
domain="[('create_date','>',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"/>
|
||||
<separator orientation="vertical" />
|
||||
<filter icon="terp-check"
|
||||
string="Current"
|
||||
domain="[('state','in',('draft','open'))]"/>
|
||||
<filter icon="terp-check"
|
||||
string="Closed"
|
||||
domain="[('state','=','done')]"/>
|
||||
<separator orientation="vertical" />
|
||||
<field name="section_id"
|
||||
default="context.get('section_id', False)"
|
||||
widget="selection"
|
||||
context="{'invisible_section': False}"/>
|
||||
<field name="grade_id"/>
|
||||
<field name="user_id"/>
|
||||
<field name="partner_assigned_id"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="1" string="Group By...">
|
||||
<filter string="User" name="user" icon="terp-personal"
|
||||
domain="[]" context="{'group_by':'user_id'}" />
|
||||
<filter string="Partner" icon="terp-personal" context="{'group_by':'partner_assigned_id'}" />
|
||||
<filter string="Country" icon="terp-go-home" context="{'group_by':'country_id'}" />
|
||||
<separator orientation="vertical" />
|
||||
<filter string="Section" icon="terp-personal+"
|
||||
domain="[]"
|
||||
context="{'group_by':'section_id'}" />
|
||||
<filter string="Grade" name="group_grade" icon="terp-stock_symbol-selection"
|
||||
domain="[]" context="{'group_by':'grade_id'}" />
|
||||
<filter string="Category" icon="terp-stock_symbol-selection"
|
||||
domain="[]" context="{'group_by':'categ_id'}" />
|
||||
|
||||
<separator orientation="vertical" />
|
||||
<filter string="Stage" icon="terp-stage" domain="[]" context="{'group_by':'stage_id'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Priority" icon="terp-rating-rated" domain="[]" context="{'group_by':'priority'}" />
|
||||
<separator orientation="vertical" />
|
||||
<filter string="State" icon="terp-stock_effects-object-colorize"
|
||||
domain="[]" context="{'group_by':'state'}" />
|
||||
<separator orientation="vertical" />
|
||||
<filter string="Company" icon="terp-go-home"
|
||||
domain="[]"
|
||||
context="{'group_by':'company_id'}" />
|
||||
<separator orientation="vertical" />
|
||||
<filter string="Partner Date" icon="terp-go-today"
|
||||
domain="[]"
|
||||
name="group_partner_date"
|
||||
context="{'group_by':'partner_date'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Day" icon="terp-go-today"
|
||||
domain="[]" context="{'group_by':'day'}"/>
|
||||
<filter string="Month" icon="terp-go-month"
|
||||
domain="[]" context="{'group_by':'month'}" />
|
||||
<filter string="Year" icon="terp-go-year"
|
||||
domain="[]" context="{'group_by':'name'}" />
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Extended Filters..." groups="base.group_extended">
|
||||
<field name="partner_id"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="stage_id" widget="selection" domain="[('object_id.model', '=', 'crm.lead')]" />
|
||||
<field name="categ_id" widget="selection" domain="[('object_id.model', '=', 'crm.lead')]"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
|
||||
<newline/>
|
||||
<field name="creation_date"/>
|
||||
<field name="opening_date"/>
|
||||
<field name="date_closed"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
<record id="view_report_crm_opportunity_assign_tree" model="ir.ui.view">
|
||||
<field name="name">crm.lead.assign.report.tree</field>
|
||||
<field name="model">crm.lead.report.assign</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Opportunities Assignment Analysis">
|
||||
<field name="name" invisible="1"/>
|
||||
<field name="month" invisible="1"/>
|
||||
<field name="partner_date" invisible="1"/>
|
||||
<field name="section_id" invisible="1" groups="base.group_extended"/>
|
||||
<field name="user_id" invisible="1"/>
|
||||
<field name="grade_id" invisible="1" widget="selection"/>
|
||||
<field name="partner_assigned_id" invisible="1"/>
|
||||
<field name="partner_id" invisible="1"/>
|
||||
<field name="country_id" invisible="1"/>
|
||||
<field name="day" invisible="1"/>
|
||||
<field name="state" invisible="1"/>
|
||||
<field name="stage_id" invisible="1"/>
|
||||
<field name="priority" invisible="1"/>
|
||||
<field name="categ_id" invisible="1"/>
|
||||
<field name="type" invisible="1"/>
|
||||
<field name="company_id" invisible="1" groups="base.group_multi_company"/>
|
||||
<field name="nbr" string="#Opportunities" sum="#Opportunities"/>
|
||||
<field name="planned_revenue" sum="Planned Revenues"/>
|
||||
<field name="delay_open" sum='Delay to open'/>
|
||||
<field name="delay_close" sum='Delay to close'/>
|
||||
<field name="delay_expected"/>
|
||||
<field name="probability" widget="progressbar"/>
|
||||
<field name="probability_max" widget="progressbar"/>
|
||||
<field name="probable_revenue"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Leads by user and section Action -->
|
||||
|
||||
<record id="action_report_crm_opportunity_assign" model="ir.actions.act_window">
|
||||
<field name="name">Opp. Assignment Analysis</field>
|
||||
<field name="res_model">crm.lead.report.assign</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="context">{"search_default_group_partner_date": 1, "search_default_group_grade":1,'group_by_no_leaf':1,'group_by':[]}</field>
|
||||
<field name="view_mode">tree</field>
|
||||
<field name="domain">[('type', '=', 'opportunity')]</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window.view" id="action_report_crm_opportunity_assign_tree">
|
||||
<field name="sequence" eval="1"/>
|
||||
<field name="view_mode">tree</field>
|
||||
<field name="view_id" ref="view_report_crm_opportunity_assign_tree"/>
|
||||
<field name="act_window_id" ref="action_report_crm_opportunity_assign"/>
|
||||
</record>
|
||||
|
||||
<menuitem id="menu_report_crm_opportunities_assign_tree"
|
||||
groups="base.group_extended"
|
||||
parent="base.next_id_64" action="action_report_crm_opportunity_assign" sequence="5"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -1,62 +1,126 @@
|
||||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="view_crm_partner_geo_form" model="ir.ui.view">
|
||||
<field name="name">res.partner.geo.inherit</field>
|
||||
<field name="model">res.partner</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="base.view_partner_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//notebook[last()]" position="inside">
|
||||
<page string="Geo Localization">
|
||||
<field name="partner_weight"/>
|
||||
<label string="" colspan="1"/>
|
||||
<button
|
||||
string="Geo Localize"
|
||||
name="geo_localize"
|
||||
icon="gtk-apply"
|
||||
type="object"/>
|
||||
<newline/>
|
||||
<field name="partner_latitude"/>
|
||||
<field name="partner_longitude"/>
|
||||
<field name="date_localization"/>
|
||||
<!--Partner Grade -->
|
||||
|
||||
<field name="opportunity_assigned_ids" colspan="4" nolabel="1">
|
||||
<tree string="Assigned Opportunities" colors="blue:state=='pending';gray:state=='cancel'">
|
||||
<field name="create_date"/>
|
||||
<field name="name"/>
|
||||
<field name="type"/>
|
||||
<field name="stage_id"/>
|
||||
<button name="stage_previous" string="Previous"
|
||||
states="open,pending" type="object" icon="gtk-go-back" />
|
||||
<button name="stage_next" string="Next"
|
||||
states="open,pending" type="object"
|
||||
icon="gtk-go-forward" />
|
||||
<field name="section_id"
|
||||
invisible="context.get('invisible_section', True)" />
|
||||
<field name="user_id" />
|
||||
<field name="state" />
|
||||
<button name="case_open" string="Open"
|
||||
states="draft,pending" type="object"
|
||||
icon="gtk-go-forward" />
|
||||
<button name="case_close" string="Close"
|
||||
states="open,draft,pending" type="object"
|
||||
icon="gtk-close" />
|
||||
<button string="Convert to Opportunity"
|
||||
name="convert_opportunity"
|
||||
states="draft,open,pending" icon="gtk-index"
|
||||
type="object" attrs="{'invisible':[('type','=','opportunity')]}" />
|
||||
<button name="case_escalate" string="Escalate"
|
||||
states="open,draft,pending" type="object"
|
||||
icon="gtk-go-up" />
|
||||
<button name="case_cancel" string="Cancel"
|
||||
states="draft,open,pending" type="object"
|
||||
icon="gtk-cancel" />
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
</xpath>
|
||||
|
||||
<record id="view_partner_grade_tree" model="ir.ui.view">
|
||||
<field name="name">res.partner.grade.tree</field>
|
||||
<field name="model">res.partner.grade</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Partner Grade">
|
||||
<field name="sequence" invisible="1"/>
|
||||
<field name="name"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
<record id="view_partner_grade_form" model="ir.ui.view">
|
||||
<field name="name">res.partner.grade.form</field>
|
||||
<field name="model">res.partner.grade</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Partner Grade">
|
||||
<group col="6" colspan="4">
|
||||
<field name="name" select="1"/>
|
||||
<field name="sequence"/>
|
||||
<field name="active"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record id="res_partner_grade_action" model="ir.actions.act_window">
|
||||
<field name="name">Partner Grade</field>
|
||||
<field name="res_model">res.partner.grade</field>
|
||||
<field name="view_type">form</field>
|
||||
</record>
|
||||
<menuitem action="res_partner_grade_action" id="menu_res_partner_grade_action"
|
||||
groups="base.group_extended"
|
||||
parent="base.menu_crm_config_lead" />
|
||||
|
||||
<!-- Partner form -->
|
||||
<record id="view_res_partner_filter_assign_tree" model="ir.ui.view">
|
||||
<field name="name">res.partner.geo.inherit.tree</field>
|
||||
<field name="model">res.partner</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="inherit_id" ref="base.view_partner_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="user_id" position="after">
|
||||
<field name="grade_id"/>
|
||||
</field>
|
||||
</record>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_res_partner_filter_assign" model="ir.ui.view">
|
||||
<field name="name">res.partner.geo.inherit.search</field>
|
||||
<field name="model">res.partner</field>
|
||||
<field name="type">search</field>
|
||||
<field name="inherit_id" ref="base.view_res_partner_filter"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="category_id" position="after">
|
||||
<field name="grade_id"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_crm_partner_geo_form" model="ir.ui.view">
|
||||
<field name="name">res.partner.geo.inherit</field>
|
||||
<field name="model">res.partner</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="base.view_partner_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//notebook[last()]" position="inside">
|
||||
<page string="Geo Localization">
|
||||
<field name="grade_id" widget="selection"/>
|
||||
<newline/>
|
||||
<field name="partner_weight"/>
|
||||
<label string="" colspan="1"/>
|
||||
<button
|
||||
string="Geo Localize"
|
||||
name="geo_localize"
|
||||
icon="gtk-apply"
|
||||
type="object"/>
|
||||
<newline/>
|
||||
<field name="partner_latitude"/>
|
||||
<field name="partner_longitude"/>
|
||||
<field name="date_localization"/>
|
||||
|
||||
<field name="opportunity_assigned_ids" colspan="4" nolabel="1">
|
||||
<tree string="Assigned Opportunities" colors="blue:state=='pending';gray:state=='cancel'">
|
||||
<field name="create_date"/>
|
||||
<field name="name"/>
|
||||
<field name="type"/>
|
||||
<field name="stage_id"/>
|
||||
<button name="stage_previous" string="Previous"
|
||||
states="open,pending" type="object" icon="gtk-go-back" />
|
||||
<button name="stage_next" string="Next"
|
||||
states="open,pending" type="object"
|
||||
icon="gtk-go-forward" />
|
||||
<field name="section_id"
|
||||
invisible="context.get('invisible_section', True)" />
|
||||
<field name="user_id" />
|
||||
<field name="state" />
|
||||
<button name="case_open" string="Open"
|
||||
states="draft,pending" type="object"
|
||||
icon="gtk-go-forward" />
|
||||
<button name="case_close" string="Close"
|
||||
states="open,draft,pending" type="object"
|
||||
icon="gtk-close" />
|
||||
<button string="Convert to Opportunity"
|
||||
name="convert_opportunity"
|
||||
states="draft,open,pending" icon="gtk-index"
|
||||
type="object" attrs="{'invisible':[('type','=','opportunity')]}" />
|
||||
<button name="case_escalate" string="Escalate"
|
||||
states="open,draft,pending" type="object"
|
||||
icon="gtk-go-up" />
|
||||
<button name="case_cancel" string="Cancel"
|
||||
states="draft,open,pending" type="object"
|
||||
icon="gtk-cancel" />
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -20,6 +20,9 @@
|
||||
##############################################################################
|
||||
|
||||
from osv import osv, fields
|
||||
from tools import cache
|
||||
import pooler
|
||||
|
||||
|
||||
class decimal_precision(osv.osv):
|
||||
_name = 'decimal.precision'
|
||||
@@ -30,23 +33,32 @@ class decimal_precision(osv.osv):
|
||||
_defaults = {
|
||||
'digits': lambda *a : 2,
|
||||
}
|
||||
|
||||
_sql_constraints = [
|
||||
('name_uniq', 'unique (name)', """The Usage of the decimal precision must be unique!"""),
|
||||
]
|
||||
|
||||
@cache(skiparg=3)
|
||||
def precision_get(self, cr, uid, application):
|
||||
cr.execute('select digits from decimal_precision where name=%s', (application,))
|
||||
res = cr.fetchone()
|
||||
return res and res[0] or 2
|
||||
|
||||
def write(self, cr, uid, ids, data, *args, **argv):
|
||||
self.precision_get.clear_cache(cr.dbname)
|
||||
res = super(decimal_precision, self).write(cr, uid, ids, data, *args, **argv)
|
||||
for obj in self.pool.obj_list():
|
||||
for colname,col in self.pool.get(obj)._columns.items():
|
||||
if isinstance(col, fields.float):
|
||||
col.digits_change(cr)
|
||||
return res
|
||||
|
||||
decimal_precision()
|
||||
|
||||
|
||||
def get_precision(application):
|
||||
def change_digit(cr):
|
||||
cr.execute('select digits from decimal_precision where name=%s', (application,))
|
||||
res = cr.fetchone()
|
||||
return (16,res and res[0] or 2)
|
||||
return pooler.get_pool(cr.dbname).get('decimal.precision').precision_get(cr, 1, application)
|
||||
return change_digit
|
||||
|
||||
|
||||
|
||||
@@ -27,28 +27,39 @@ from mx import DateTime
|
||||
from tools.translate import _
|
||||
|
||||
class one2many_mod2(fields.one2many):
|
||||
def get(self, cr, obj, ids, name, user=None, offset=0, context={}, values={}):
|
||||
res = {}
|
||||
for id in ids:
|
||||
res[id] = []
|
||||
def get(self, cr, obj, ids, name, user=None, offset=0, context=None, values=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
res5 = obj.read(cr, user, ids, ['date_current', 'user_id'], context=context)
|
||||
res6 = {}
|
||||
for r in res5:
|
||||
res6[r['id']] = (r['date_current'], r['user_id'][0])
|
||||
if values is None:
|
||||
values = {}
|
||||
|
||||
ids2 = []
|
||||
for id in ids:
|
||||
dom = []
|
||||
res = {}.fromkeys(ids, [])
|
||||
|
||||
# dict:
|
||||
# {idn: (date_current, user_id), ...
|
||||
# 1: ('2010-08-15', 1)}
|
||||
res6 = dict([(rec['id'], (rec['date_current'], rec['user_id'][0]))
|
||||
for rec
|
||||
in obj.read(cr, user, ids, ['date_current', 'user_id'], context=context)])
|
||||
|
||||
# eg: ['|', '|',
|
||||
# '&', '&', ('name', '>=', '2011-03-01'), ('name', '<=', '2011-03-01'), ('employee_id.user_id', '=', 1),
|
||||
# '&', '&', ('name', '>=', '2011-02-01'), ('name', '<=', '2011-02-01'), ('employee_id.user_id', '=', 1)]
|
||||
dom = []
|
||||
for c, id in enumerate(ids):
|
||||
if id in res6:
|
||||
dom = [('name', '>=', res6[id][0] + ' 00:00:00'),
|
||||
('name', '<=', res6[id][0] + ' 23:59:59'),
|
||||
('employee_id.user_id', '=', res6[id][1])]
|
||||
ids2.extend(obj.pool.get(self._obj).search(cr, user,
|
||||
dom, limit=self._limit))
|
||||
if c: # skip first
|
||||
dom.insert(0 ,'|')
|
||||
dom.append('&')
|
||||
dom.append('&')
|
||||
dom.append(('name', '>=', res6[id][0]))
|
||||
dom.append(('name', '<=', res6[id][0]))
|
||||
dom.append(('employee_id.user_id', '=', res6[id][1]))
|
||||
|
||||
for r in obj.pool.get(self._obj)._read_flat(cr, user, ids2,
|
||||
[self._fields_id], context=context, load='_classic_write'):
|
||||
ids2 = obj.pool.get(self._obj).search(cr, user, dom, limit=self._limit)
|
||||
|
||||
for r in obj.pool.get(self._obj)._read_flat(cr, user, ids2, [self._fields_id], context=context, load='_classic_write'):
|
||||
if r[self._fields_id]:
|
||||
res.setdefault(r[self._fields_id][0], []).append(r['id'])
|
||||
|
||||
@@ -57,17 +68,21 @@ class one2many_mod2(fields.one2many):
|
||||
def set(self, cr, obj, id, field, values, user=None, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
context = context.copy()
|
||||
context['sheet_id'] = id
|
||||
return super(one2many_mod2, self).set(cr, obj, id, field, values, user=user,
|
||||
context=context)
|
||||
return super(one2many_mod2, self).set(cr, obj, id, field, values, user=user, context=context)
|
||||
|
||||
|
||||
class one2many_mod(fields.one2many):
|
||||
def get(self, cr, obj, ids, name, user=None, offset=0, context={}, values={}):
|
||||
res = {}
|
||||
for id in ids:
|
||||
res[id] = []
|
||||
def get(self, cr, obj, ids, name, user=None, offset=0, context=None, values=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
if values is None:
|
||||
values = {}
|
||||
|
||||
res = {}.fromkeys(ids, [])
|
||||
|
||||
res5 = obj.read(cr, user, ids, ['date_current', 'user_id'], context=context)
|
||||
res6 = {}
|
||||
|
||||
@@ -378,7 +378,6 @@ class one2many_domain(fields.one2many):
|
||||
|
||||
move_obj = obj.pool.get('stock.move')
|
||||
res = {}.fromkeys(ids, [])
|
||||
key = operator.itemgetter(0)
|
||||
move_ids = move_obj.search(cr, user, self._domain+[('production_id', 'in', tuple(ids))], context=context)
|
||||
related_move_dict = dict([(o.production_id.id, [o.id]) for o in move_obj.browse(cr, user, move_ids, context=context)])
|
||||
res.update(related_move_dict)
|
||||
|
||||
@@ -463,18 +463,17 @@
|
||||
<field name="uom_id" ref="product_uom_unit"/>
|
||||
<field name="uom_po_id" ref="product_uom_unit"/>
|
||||
<field name="name">Restaurant Expenses</field>
|
||||
<field eval="1" name="hr_expense_ok"/>
|
||||
<field name="categ_id" ref="product_category_otherproducts0"/>
|
||||
</record>
|
||||
|
||||
<record id="product_product_worker0" model="product.product">
|
||||
<field name="default_code">WORK</field>
|
||||
<field name="supply_method">produce</field>
|
||||
<field name="type">service</field>
|
||||
<field eval="'make_to_order'" name="procure_method"/>
|
||||
<field name="default_code">WORK</field>
|
||||
<field name="supply_method">produce</field>
|
||||
<field name="type">service</field>
|
||||
<field eval="'make_to_order'" name="procure_method"/>
|
||||
<field eval="0" name="sale_ok"/>
|
||||
<field eval="1" name="purchase_ok"/>
|
||||
<field name="standard_price">20.0</field>
|
||||
<field name="standard_price">20.0</field>
|
||||
<field name="uom_id" ref="uom_hour"/>
|
||||
<field name="uom_po_id" ref="uom_hour"/>
|
||||
<field name="name">Worker</field>
|
||||
@@ -486,15 +485,12 @@
|
||||
<field name="supply_method">buy</field>
|
||||
<field name="standard_price">10.0</field>
|
||||
<field eval="0" name="sale_ok"/>
|
||||
<field name="uom_id" ref="product_uom_unit"/>
|
||||
<field name="uom_po_id" ref="product_uom_unit"/>
|
||||
<field name="name">Rear Panel SHE100</field>
|
||||
<field eval="'Public Pricelist (0.00) : 1.00
|
||||
One-shot customers (0.00) : 1.00
|
||||
Returning customers (0.00) : 0.99'" name="pricelist_sale"/>
|
||||
<field name="uom_id" ref="product_uom_unit"/>
|
||||
<field name="uom_po_id" ref="product_uom_unit"/>
|
||||
<field name="name">Rear Panel SHE100</field>
|
||||
<field eval="5" name="seller_delay"/>
|
||||
<field name="categ_id" ref="product_category_misc0"/>
|
||||
</record>
|
||||
<field name="categ_id" ref="product_category_misc0"/>
|
||||
</record>
|
||||
|
||||
<record id="product_product_rearpanelarm1" model="product.product">
|
||||
<field name="default_code">RPAN200</field>
|
||||
@@ -504,9 +500,6 @@ Returning customers (0.00) : 0.99'" name="pricelist_sale"/>
|
||||
<field name="uom_id" ref="product_uom_unit"/>
|
||||
<field name="uom_po_id" ref="product_uom_unit"/>
|
||||
<field name="name">Rear Panel SHE200</field>
|
||||
<field eval="'Public Pricelist (0.00) : 1.00
|
||||
One-shot customers (0.00) : 1.00
|
||||
Returning customers (0.00) : 0.99'" name="pricelist_sale"/>
|
||||
<field eval="5" name="seller_delay"/>
|
||||
<field name="categ_id" ref="product_category_misc0"/>
|
||||
</record>
|
||||
@@ -519,9 +512,6 @@ Returning customers (0.00) : 0.99'" name="pricelist_sale"/>
|
||||
<field name="uom_id" ref="product_uom_unit"/>
|
||||
<field name="uom_po_id" ref="product_uom_unit"/>
|
||||
<field name="name">Side Panel</field>
|
||||
<field eval="'Public Pricelist (0.00) : 1.00
|
||||
One-shot customers (0.00) : 1.00
|
||||
Returning customers (0.00) : 0.99'" name="pricelist_sale"/>
|
||||
<field eval="5" name="seller_delay"/>
|
||||
<field name="categ_id" ref="product_category_misc0"/>
|
||||
</record>
|
||||
@@ -534,9 +524,6 @@ Returning customers (0.00) : 0.99'" name="pricelist_sale"/>
|
||||
<field name="uom_id" ref="product_uom_unit"/>
|
||||
<field name="uom_po_id" ref="product_uom_unit"/>
|
||||
<field name="name">Rack 100cm</field>
|
||||
<field eval="'Public Pricelist (0.00) : 1.00
|
||||
One-shot customers (0.00) : 1.00
|
||||
Returning customers (0.00) : 0.99'" name="pricelist_sale"/>
|
||||
<field eval="8" name="seller_delay"/>
|
||||
<field name="categ_id" ref="product_category_misc0"/>
|
||||
</record>
|
||||
@@ -549,9 +536,6 @@ Returning customers (0.00) : 0.99'" name="pricelist_sale"/>
|
||||
<field name="uom_id" ref="product_uom_unit"/>
|
||||
<field name="uom_po_id" ref="product_uom_unit"/>
|
||||
<field name="name">Rack 200cm</field>
|
||||
<field eval="'Public Pricelist (0.00) : 1.00
|
||||
One-shot customers (0.00) : 1.00
|
||||
Returning customers (0.00) : 0.99'" name="pricelist_sale"/>
|
||||
<field eval="8" name="seller_delay"/>
|
||||
<field name="categ_id" ref="product_category_misc0"/>
|
||||
</record>
|
||||
@@ -576,9 +560,6 @@ Returning customers (0.00) : 0.99'" name="pricelist_sale"/>
|
||||
<field name="uom_id" ref="product_uom_unit"/>
|
||||
<field name="uom_po_id" ref="product_uom_unit"/>
|
||||
<field name="name">Wood Lintel 4m</field>
|
||||
<field eval="'Public Pricelist (0.00) : 1.00
|
||||
One-shot customers (0.00) : 1.00
|
||||
Returning customers (0.00) : 0.99'" name="pricelist_sale"/>
|
||||
<field eval="10" name="seller_delay"/>
|
||||
<field name="categ_id" ref="product_category_misc0"/>
|
||||
</record>
|
||||
@@ -590,9 +571,6 @@ Returning customers (0.00) : 0.99'" name="pricelist_sale"/>
|
||||
<field name="uom_id" ref="product_uom_unit"/>
|
||||
<field name="uom_po_id" ref="product_uom_unit"/>
|
||||
<field name="name">Metal Cleats</field>
|
||||
<field eval="'Public Pricelist (0.00) : 1.00
|
||||
One-shot customers (0.00) : 1.00
|
||||
Returning customers (0.00) : 0.99'" name="pricelist_sale"/>
|
||||
<field eval="20" name="seller_delay"/>
|
||||
<field name="categ_id" ref="product_category_misc0"/>
|
||||
</record>
|
||||
@@ -607,7 +585,6 @@ Returning customers (0.00) : 0.99'" name="pricelist_sale"/>
|
||||
<field name="uom_id" ref="product_uom_unit"/>
|
||||
<field name="uom_po_id" ref="product_uom_unit"/>
|
||||
<field name="name">Hotel Expenses</field>
|
||||
<field eval="1" name="hr_expense_ok"/>
|
||||
<field name="categ_id" ref="product_category_otherproducts0"/>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
-
|
||||
!python {model: product.product}: |
|
||||
import netsvc, tools, os
|
||||
data_dict = {'model': 'product.price_list'}
|
||||
data_dict = {'model': 'product.product'}
|
||||
data_dict['form'] = {
|
||||
'qty1': 1,
|
||||
'qty2': 5,
|
||||
|
||||
@@ -193,6 +193,48 @@
|
||||
<field name="uom_id" ref="product.product_uom_unit"/>
|
||||
<field name="uom_po_id" ref="product.product_uom_unit"/>
|
||||
</record>
|
||||
|
||||
<record id="product.product_product_rearpanelarm0" model="product.product">
|
||||
<field eval="'Public Pricelist (0.00) : 1.00
|
||||
One-shot customers (0.00) : 1.00
|
||||
Returning customers (0.00) : 0.99'" name="pricelist_sale"/>
|
||||
</record>
|
||||
|
||||
<record id="product.product_product_rearpanelarm1" model="product.product">
|
||||
<field eval="'Public Pricelist (0.00) : 1.00
|
||||
One-shot customers (0.00) : 1.00
|
||||
Returning customers (0.00) : 0.99'" name="pricelist_sale"/>
|
||||
</record>
|
||||
|
||||
<record id="product.product_product_sidepanel0" model="product.product">
|
||||
<field eval="'Public Pricelist (0.00) : 1.00
|
||||
One-shot customers (0.00) : 1.00
|
||||
Returning customers (0.00) : 0.99'" name="pricelist_sale"/>
|
||||
</record>
|
||||
|
||||
<record id="product.product_product_shelf0" model="product.product">
|
||||
<field eval="'Public Pricelist (0.00) : 1.00
|
||||
One-shot customers (0.00) : 1.00
|
||||
Returning customers (0.00) : 0.99'" name="pricelist_sale"/>
|
||||
</record>
|
||||
|
||||
<record id="product.product_product_shelf1" model="product.product">
|
||||
<field eval="'Public Pricelist (0.00) : 1.00
|
||||
One-shot customers (0.00) : 1.00
|
||||
Returning customers (0.00) : 0.99'" name="pricelist_sale"/>
|
||||
</record>
|
||||
|
||||
<record id="product.product_product_woodlintelm0" model="product.product">
|
||||
<field eval="'Public Pricelist (0.00) : 1.00
|
||||
One-shot customers (0.00) : 1.00
|
||||
Returning customers (0.00) : 0.99'" name="pricelist_sale"/>
|
||||
</record>
|
||||
|
||||
<record id="product.product_product_metalcleats0" model="product.product">
|
||||
<field eval="'Public Pricelist (0.00) : 1.00
|
||||
One-shot customers (0.00) : 1.00
|
||||
Returning customers (0.00) : 0.99'" name="pricelist_sale"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -1450,7 +1450,7 @@ class stock_move(osv.osv):
|
||||
'date': fields.datetime('Creation Date', select=True),
|
||||
'date_planned': fields.datetime('Date', required=True, help="Scheduled date for the movement of the products or real date if the move is done."),
|
||||
'date_expected': fields.datetime('Date Expected', readonly=True,required=True, help="Scheduled date for the movement of the products"),
|
||||
'product_id': fields.many2one('product.product', 'Product', required=True, select=True),
|
||||
'product_id': fields.many2one('product.product', 'Product', required=True, select=True, domain=[('type','<>','service')]),
|
||||
|
||||
'product_qty': fields.float('Quantity', required=True),
|
||||
'product_uom': fields.many2one('product.uom', 'Unit of Measure', required=True),
|
||||
|
||||
Reference in New Issue
Block a user