Dears:
I want to achieve through automated scheduling to complete as long as there is a BOM component of the product at a point in time to calculate the price. So I made reference to the product_extended and online knowledge to write a module.
However, it seems that all of the products found out after the start of the calculation is actually not written into odoo.
Test only one piece of material circumstances, this module will be normal to write.
Whether there are experts under the guidance of how to amend this situation.
__________________
def compute_price_schedular(self, cr, uid, template_ids=False, recursive=False, test=False, context=None):
template_ids = self.search(cr, uid, [("cost_method", "=", "standard"), ("bom_ids", '!=', False)])
testdict = {}
for x in template_ids:
bom_obj = self.pool.get('mrp.bom')
bom_id = bom_obj._bom_find(cr, uid, product_tmpl_id=x or [], context=context)
if bom_id:
if recursive:
bom = bom_obj.browse(cr, uid, bom_id, context=context)
prod_set = set([y.product_id.id for y in bom.bom_line_ids])
res = self.compute_price_schedular(cr, uid, list(prod_set), recursive, test=test, context=context)
if test:
testdict.update(res)
price = self.calc_product_price(cr, uid, bom_obj.browse(cr, uid, bom_id, context=context), test=test, context=context)
if test:
testdict.update({x: price})
if test:
return testdict
else:
return True
--------------------------------------------------------------------------