[FIX] procurement: return False in check_move_done if service product
[REF] procurment: check_produce method to take main supplier in one line if supply method is not produce [IMP] project_mrp: improve yml, demo with service product "Advance" and order "order7" bzr revid: hmo@tinyerp.com-20111213132904-ibxh3yjszps3q3ee
This commit is contained in:
parent
f64335b341
commit
09f1515ea9
|
@ -174,9 +174,11 @@ class procurement_order(osv.osv):
|
|||
""" Checks if move is done or not.
|
||||
@return: True or False.
|
||||
"""
|
||||
if not context:
|
||||
context = {}
|
||||
return all(not procurement.move_id or procurement.move_id.state == 'done' for procurement in self.browse(cr, uid, ids, context=context))
|
||||
res = False
|
||||
for procurement in self.browse(cr, uid, ids, context=context):
|
||||
if procurement.move_id and procurement.move_id.state == 'done':
|
||||
res = True
|
||||
return res
|
||||
#
|
||||
# This method may be overrided by objects that override procurement.order
|
||||
# for computing their own purpose
|
||||
|
@ -263,15 +265,15 @@ class procurement_order(osv.osv):
|
|||
res = True
|
||||
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
|
||||
for procurement in self.browse(cr, uid, ids, context=context):
|
||||
if procurement.product_id.product_tmpl_id.supply_method <> 'produce':
|
||||
partner_list = sorted([(partner_id.sequence, partner_id) for partner_id in procurement.product_id.seller_ids if partner_id])
|
||||
if partner_list:
|
||||
partner = partner_list and partner_list[0] and partner_list[0][1] and partner_list[0][1].name or False
|
||||
if user.company_id and user.company_id.partner_id:
|
||||
if partner.id == user.company_id.partner_id.id:
|
||||
return True
|
||||
return False
|
||||
if procurement.product_id.product_tmpl_id.type=='service':
|
||||
product = procurement.product_id
|
||||
#TOFIX: if product type is 'service' but supply_method is 'buy'.
|
||||
if product.supply_method <> 'produce':
|
||||
supplier = product.seller_id
|
||||
if supplier and user.company_id and user.company_id.partner_id:
|
||||
if supplier.id == user.company_id.partner_id.id:
|
||||
res = True
|
||||
res = False
|
||||
if procurement.product_id.type=='service':
|
||||
res = res and self.check_produce_service(cr, uid, procurement, context)
|
||||
else:
|
||||
res = res and self.check_produce_product(cr, uid, procurement, context)
|
||||
|
|
|
@ -169,7 +169,7 @@
|
|||
<field name="condition">not check_product()</field>
|
||||
</record>
|
||||
<record id="trans_make_to_stock_make_done" model="workflow.transition">
|
||||
<field name="act_from" ref="act_make_to_stock"/>
|
||||
<field name="act_from" ref="act_make_to_stock"/> <!-- TOFIX: If product is service product and procure method is 'make_to_stock', procurement is closed without generated service -->
|
||||
<field name="act_to" ref="act_make_done"/>
|
||||
<field name="condition">True</field>
|
||||
<field name="trigger_model" eval="False"/>
|
||||
|
|
|
@ -5,14 +5,14 @@
|
|||
<!--Resource: sale.order.line for services type product-->
|
||||
|
||||
<record id="line_services" model="sale.order.line">
|
||||
<field name="order_id" ref="sale.order"/>
|
||||
<field name="name">Partners Training</field>
|
||||
<field name="product_id" ref="product.product_product_kitchendesignproject0"/>
|
||||
<field name="order_id" ref="sale.order7"/>
|
||||
<field name="name">Advance</field>
|
||||
<field name="product_id" ref="sale.advance_product_0"/>
|
||||
<field name="product_uom" ref="product.uom_day"/>
|
||||
<field name="price_unit">1.0</field>
|
||||
<field name="price_unit">150.0</field>
|
||||
<field name="product_uom_qty">5.0</field>
|
||||
<field name="type">make_to_order</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
</openerp>
|
||||
|
|
|
@ -29,7 +29,7 @@ class procurement_order(osv.osv):
|
|||
'sale_line_id': fields.many2one('sale.order.line', 'Sale order line')
|
||||
}
|
||||
|
||||
def check_produce_service(self, cr, uid, procurement, context=None):
|
||||
def check_produce_service(self, cr, uid, procurement, context=None):
|
||||
return True
|
||||
|
||||
def _convert_qty_company_hours(self, cr, uid, procurement, context=None):
|
||||
|
@ -43,7 +43,6 @@ class procurement_order(osv.osv):
|
|||
|
||||
def action_produce_assign_service(self, cr, uid, ids, context=None):
|
||||
project_task = self.pool.get('project.task')
|
||||
|
||||
for procurement in self.browse(cr, uid, ids, context=context):
|
||||
project_id = False
|
||||
if procurement.product_id.project_id:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
-
|
||||
In order to test process to generate task automatic from procurement, I confirm sale order to sale service product.
|
||||
-
|
||||
!workflow {model: sale.order, action: order_confirm, ref: sale.order}
|
||||
!workflow {model: sale.order, action: order_confirm, ref: sale.order7}
|
||||
-
|
||||
I run the scheduler.
|
||||
-
|
||||
|
|
|
@ -272,8 +272,9 @@
|
|||
<field name="type">service</field>
|
||||
<field name="list_price">150.0</field>
|
||||
<field name="standard_price">100.0</field>
|
||||
<field name="uom_id" ref="product.product_uom_unit"/>
|
||||
<field name="uom_po_id" ref="product.product_uom_unit"/>
|
||||
<field name="supply_method">produce</field>
|
||||
<field name="uom_id" ref="product.uom_day"/>
|
||||
<field name="uom_po_id" ref="product.uom_day"/>
|
||||
</record>
|
||||
|
||||
<record id="base.user_demo" model="res.users">
|
||||
|
|
Loading…
Reference in New Issue