[IMP] Put wkf_action_cancel back, so the method does not call itself recursively (issue 2079)
This commit is contained in:
parent
1512534320
commit
d38fafdee8
|
@ -672,6 +672,11 @@ class purchase_order(osv.osv):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def wkf_action_cancel(self, cr, uid, ids, context=None):
|
||||||
|
self.write(cr, uid, ids, {'state': 'cancel'})
|
||||||
|
self.set_order_line_status(cr, uid, ids, 'cancel', context=context)
|
||||||
|
|
||||||
|
|
||||||
def action_cancel(self, cr, uid, ids, context=None):
|
def action_cancel(self, cr, uid, ids, context=None):
|
||||||
for purchase in self.browse(cr, uid, ids, context=context):
|
for purchase in self.browse(cr, uid, ids, context=context):
|
||||||
for pick in purchase.picking_ids:
|
for pick in purchase.picking_ids:
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
<field name="name">cancel</field>
|
<field name="name">cancel</field>
|
||||||
<field name="kind">function</field>
|
<field name="kind">function</field>
|
||||||
<field name="flow_stop">True</field>
|
<field name="flow_stop">True</field>
|
||||||
<field name="action">action_cancel()</field>
|
<field name="action">wkf_action_cancel()</field>
|
||||||
</record>
|
</record>
|
||||||
<record id="act_except_invoice" model="workflow.activity">
|
<record id="act_except_invoice" model="workflow.activity">
|
||||||
<field name="wkf_id" ref="purchase_order"/>
|
<field name="wkf_id" ref="purchase_order"/>
|
||||||
|
|
|
@ -70,7 +70,7 @@ class stock_move(osv.osv):
|
||||||
purchase_order = move.purchase_line_id.order_id
|
purchase_order = move.purchase_line_id.order_id
|
||||||
return purchase_order.partner_id, purchase_order.create_uid.id, purchase_order.currency_id.id
|
return purchase_order.partner_id, purchase_order.create_uid.id, purchase_order.currency_id.id
|
||||||
else:
|
else:
|
||||||
partner = move.partner_id or (move.picking_id and move.picking_id.partner_id) or False
|
partner = move.picking_id and move.picking_id.partner_id or False
|
||||||
if partner:
|
if partner:
|
||||||
if partner.property_product_pricelist_purchase and move.location_id.usage != 'internal' and move.location_dest_id.usage == 'internal':
|
if partner.property_product_pricelist_purchase and move.location_id.usage != 'internal' and move.location_dest_id.usage == 'internal':
|
||||||
currency = partner.property_product_pricelist_purchase.currency_id.id
|
currency = partner.property_product_pricelist_purchase.currency_id.id
|
||||||
|
@ -92,7 +92,7 @@ class stock_move(osv.osv):
|
||||||
Attribute price to move, important in inter-company moves or receipts with only one partner
|
Attribute price to move, important in inter-company moves or receipts with only one partner
|
||||||
"""
|
"""
|
||||||
if not move.purchase_line_id and move.location_id.usage != 'internal' and move.location_dest_id.usage == 'internal' and not move.price_unit:
|
if not move.purchase_line_id and move.location_id.usage != 'internal' and move.location_dest_id.usage == 'internal' and not move.price_unit:
|
||||||
partner = move.partner_id or (move.picking_id and move.picking_id.partner_id)
|
partner = move.picking_id and move.picking_id.partner_id or False
|
||||||
price = False
|
price = False
|
||||||
# If partner given, search price in its purchase pricelist
|
# If partner given, search price in its purchase pricelist
|
||||||
if partner and partner.property_product_pricelist_purchase:
|
if partner and partner.property_product_pricelist_purchase:
|
||||||
|
|
|
@ -97,7 +97,8 @@ class stock_move(osv.osv):
|
||||||
def _get_master_data(self, cr, uid, move, company, context=None):
|
def _get_master_data(self, cr, uid, move, company, context=None):
|
||||||
''' returns a tuple (browse_record(res.partner), ID(res.users), ID(res.currency)'''
|
''' returns a tuple (browse_record(res.partner), ID(res.users), ID(res.currency)'''
|
||||||
currency = company.currency_id.id
|
currency = company.currency_id.id
|
||||||
partner = move.partner_id or (move.picking_id and move.picking_id.partner_id) or False
|
import pdb; pdb.set_trace()
|
||||||
|
partner = move.picking_id and move.picking_id.partner_id
|
||||||
if partner:
|
if partner:
|
||||||
if partner.property_product_pricelist and move.location_id.usage == 'internal' and move.location_dest_id.usage != 'internal':
|
if partner.property_product_pricelist and move.location_id.usage == 'internal' and move.location_dest_id.usage != 'internal':
|
||||||
currency = partner.property_product_pricelist.currency_id.id
|
currency = partner.property_product_pricelist.currency_id.id
|
||||||
|
@ -115,12 +116,11 @@ class stock_move(osv.osv):
|
||||||
if context is None:
|
if context is None:
|
||||||
context = {}
|
context = {}
|
||||||
if type in ('in_invoice', 'in_refund'):
|
if type in ('in_invoice', 'in_refund'):
|
||||||
if move_line.partner_id:
|
if move_line.price_unit:
|
||||||
return move_line.price_unit
|
return move_line.price_unit
|
||||||
else:
|
else:
|
||||||
# Take the user company and pricetype
|
# Take the company of the move line
|
||||||
# TODO: This intercompany still needed?
|
product = move_line.product_id.with_context(company_id=move_line.company_id.id)
|
||||||
product = move_line.product_id.with_context(currency_id=move_line.company_id.currency_id.id)
|
|
||||||
amount_unit = product.price_get('standard_price')[move_line.product_id.id]
|
amount_unit = product.price_get('standard_price')[move_line.product_id.id]
|
||||||
return amount_unit
|
return amount_unit
|
||||||
else:
|
else:
|
||||||
|
@ -129,7 +129,7 @@ class stock_move(osv.osv):
|
||||||
pricelist_obj = self.pool.get("product.pricelist")
|
pricelist_obj = self.pool.get("product.pricelist")
|
||||||
pricelist = move_line.partner_id.property_product_pricelist.id
|
pricelist = move_line.partner_id.property_product_pricelist.id
|
||||||
price = pricelist_obj.price_get(cr, uid, [pricelist],
|
price = pricelist_obj.price_get(cr, uid, [pricelist],
|
||||||
product, move_line.product_uom_qty, move_line.partner_id.id, {
|
move_line.product_id.id, move_line.product_uom_qty, move_line.partner_id.id, {
|
||||||
'uom': move_line.product_uom.id,
|
'uom': move_line.product_uom.id,
|
||||||
'date': move_line.date,
|
'date': move_line.date,
|
||||||
})[pricelist]
|
})[pricelist]
|
||||||
|
@ -206,7 +206,7 @@ class stock_picking(osv.osv):
|
||||||
("2binvoiced", "To Be Invoiced"),
|
("2binvoiced", "To Be Invoiced"),
|
||||||
("none", "Not Applicable")
|
("none", "Not Applicable")
|
||||||
], string="Invoice Control", required=True,
|
], string="Invoice Control", required=True,
|
||||||
fnct_inv = _set_inv_state,
|
#fnct_inv = _set_inv_state,
|
||||||
store={
|
store={
|
||||||
'stock.picking': (lambda self, cr, uid, ids, c={}: ids, ['state'], 10),
|
'stock.picking': (lambda self, cr, uid, ids, c={}: ids, ['state'], 10),
|
||||||
'stock.move': (__get_picking_move, ['picking_id', 'invoice_state'], 10),
|
'stock.move': (__get_picking_move, ['picking_id', 'invoice_state'], 10),
|
||||||
|
|
Loading…
Reference in New Issue