[MERGE] Forward-port of latest 7.0 bugfixes, up to rev. 9701 rev-id: dle@openerp.com-20131217124201-kha2717b4ka51aih
bzr revid: dle@openerp.com-20131217142126-1lbim47d2m2x4bb0
This commit is contained in:
commit
7486095918
|
@ -46,12 +46,15 @@
|
||||||
Process Transition
|
Process Transition
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<!-- This "foreign" process node is duplicated here from the corresponding sale_stock node because
|
<!-- This process node is duplicated here from the corresponding sale_stock node because
|
||||||
`project_mrp` implements a basic procurement system for services without actually using the
|
`project_mrp` implements a basic procurement system for services without actually using the
|
||||||
full-fledged procurement process from sale_stock, and without the dependency. So it stil
|
full-fledged procurement process from sale_stock, and without the dependency. So it still
|
||||||
represents a "procurement system".
|
represents a "procurement system". Sharing the external ID causes other problems, so
|
||||||
|
we duplicate it instead.
|
||||||
|
TODO: To cleanup this duplicate node, it should probably be moved to the
|
||||||
|
`sale` module directly, and removed from both `sale_stock` and `project_mrp`.
|
||||||
-->
|
-->
|
||||||
<record id="procurement.process_node_saleprocurement0" model="process.node">
|
<record id="process_node_saleprocurement0" model="process.node">
|
||||||
<field name="menu_id" ref="procurement.menu_stock_procurement_action"/>
|
<field name="menu_id" ref="procurement.menu_stock_procurement_action"/>
|
||||||
<field name="model_id" ref="procurement.model_procurement_order"/>
|
<field name="model_id" ref="procurement.model_procurement_order"/>
|
||||||
<field name="kind">subflow</field>
|
<field name="kind">subflow</field>
|
||||||
|
@ -66,7 +69,7 @@
|
||||||
<field eval=""""Procurement Task"""" name="name"/>
|
<field eval=""""Procurement Task"""" name="name"/>
|
||||||
<field eval=""""if product type is 'service' then it creates the task."""" name="note"/>
|
<field eval=""""if product type is 'service' then it creates the task."""" name="note"/>
|
||||||
<field name="target_node_id" ref="process_node_procuretasktask0"/>
|
<field name="target_node_id" ref="process_node_procuretasktask0"/>
|
||||||
<field name="source_node_id" ref="procurement.process_node_saleprocurement0"/>
|
<field name="source_node_id" ref="process_node_saleprocurement0"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="process_transition_createtask0" model="process.transition">
|
<record id="process_transition_createtask0" model="process.transition">
|
||||||
|
|
|
@ -26,6 +26,18 @@ from dateutil import relativedelta
|
||||||
from openerp import tools
|
from openerp import tools
|
||||||
from openerp.osv import osv, fields
|
from openerp.osv import osv, fields
|
||||||
|
|
||||||
|
class res_users(osv.Model):
|
||||||
|
_inherit = 'res.users'
|
||||||
|
_columns = {
|
||||||
|
'default_section_id': fields.many2one('crm.case.section', 'Default Sales Team'),
|
||||||
|
}
|
||||||
|
|
||||||
|
def __init__(self, pool, cr):
|
||||||
|
init_res = super(res_users, self).__init__(pool, cr)
|
||||||
|
# duplicate list to avoid modifying the original reference
|
||||||
|
self.SELF_WRITEABLE_FIELDS = list(self.SELF_WRITEABLE_FIELDS)
|
||||||
|
self.SELF_WRITEABLE_FIELDS.extend(['default_section_id'])
|
||||||
|
return init_res
|
||||||
|
|
||||||
class sale_order(osv.osv):
|
class sale_order(osv.osv):
|
||||||
_inherit = 'sale.order'
|
_inherit = 'sale.order'
|
||||||
|
@ -35,6 +47,17 @@ class sale_order(osv.osv):
|
||||||
domain="['|',('section_id','=',section_id),('section_id','=',False), ('object_id.model', '=', 'crm.lead')]", context="{'object_name': 'crm.lead'}")
|
domain="['|',('section_id','=',section_id),('section_id','=',False), ('object_id.model', '=', 'crm.lead')]", context="{'object_name': 'crm.lead'}")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def _get_default_section_id(self, cr, uid, context=None):
|
||||||
|
""" Gives default section by checking if present in the context """
|
||||||
|
section_id = self.pool.get('crm.lead')._resolve_section_id_from_context(cr, uid, context=context) or False
|
||||||
|
if not section_id:
|
||||||
|
section_id = self.pool.get('res.users').browse(cr, uid, uid, context).default_section_id.id or False
|
||||||
|
return section_id
|
||||||
|
|
||||||
|
_defaults = {
|
||||||
|
'section_id': lambda s, cr, uid, c: s._get_default_section_id(cr, uid, c),
|
||||||
|
}
|
||||||
|
|
||||||
def _prepare_invoice(self, cr, uid, order, lines, context=None):
|
def _prepare_invoice(self, cr, uid, order, lines, context=None):
|
||||||
invoice_vals = super(sale_order, self)._prepare_invoice(cr, uid, order, lines, context=context)
|
invoice_vals = super(sale_order, self)._prepare_invoice(cr, uid, order, lines, context=context)
|
||||||
if order.section_id and order.section_id.id:
|
if order.section_id and order.section_id.id:
|
||||||
|
@ -92,21 +115,6 @@ class crm_case_section(osv.osv):
|
||||||
def action_forecast(self, cr, uid, id, value, context=None):
|
def action_forecast(self, cr, uid, id, value, context=None):
|
||||||
return self.write(cr, uid, [id], {'invoiced_forecast': value}, context=context)
|
return self.write(cr, uid, [id], {'invoiced_forecast': value}, context=context)
|
||||||
|
|
||||||
|
|
||||||
class res_users(osv.Model):
|
|
||||||
_inherit = 'res.users'
|
|
||||||
_columns = {
|
|
||||||
'default_section_id': fields.many2one('crm.case.section', 'Default Sales Team'),
|
|
||||||
}
|
|
||||||
|
|
||||||
def __init__(self, pool, cr):
|
|
||||||
init_res = super(res_users, self).__init__(pool, cr)
|
|
||||||
# duplicate list to avoid modifying the original reference
|
|
||||||
self.SELF_WRITEABLE_FIELDS = list(self.SELF_WRITEABLE_FIELDS)
|
|
||||||
self.SELF_WRITEABLE_FIELDS.extend(['default_section_id'])
|
|
||||||
return init_res
|
|
||||||
|
|
||||||
|
|
||||||
class sale_crm_lead(osv.Model):
|
class sale_crm_lead(osv.Model):
|
||||||
_inherit = 'crm.lead'
|
_inherit = 'crm.lead'
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue