diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py
index 02296ce4650..69535f703bb 100644
--- a/addons/purchase/purchase.py
+++ b/addons/purchase/purchase.py
@@ -672,6 +672,11 @@ class purchase_order(osv.osv):
return True
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):
for purchase in self.browse(cr, uid, ids, context=context):
for pick in purchase.picking_ids:
diff --git a/addons/purchase/purchase_workflow.xml b/addons/purchase/purchase_workflow.xml
index 810c0a74064..fe6b5a3f045 100644
--- a/addons/purchase/purchase_workflow.xml
+++ b/addons/purchase/purchase_workflow.xml
@@ -37,7 +37,7 @@
cancel
function
True
- action_cancel()
+ wkf_action_cancel()
diff --git a/addons/purchase/stock.py b/addons/purchase/stock.py
index 1e26aaa65eb..c1ccdd998d5 100644
--- a/addons/purchase/stock.py
+++ b/addons/purchase/stock.py
@@ -70,7 +70,7 @@ class stock_move(osv.osv):
purchase_order = move.purchase_line_id.order_id
return purchase_order.partner_id, purchase_order.create_uid.id, purchase_order.currency_id.id
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.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
@@ -92,7 +92,7 @@ class stock_move(osv.osv):
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:
- 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
# If partner given, search price in its purchase pricelist
if partner and partner.property_product_pricelist_purchase:
diff --git a/addons/stock_account/stock.py b/addons/stock_account/stock.py
index c662ec8c9b7..12f6c76573d 100644
--- a/addons/stock_account/stock.py
+++ b/addons/stock_account/stock.py
@@ -97,7 +97,8 @@ class stock_move(osv.osv):
def _get_master_data(self, cr, uid, move, company, context=None):
''' returns a tuple (browse_record(res.partner), ID(res.users), ID(res.currency)'''
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.property_product_pricelist and move.location_id.usage == 'internal' and move.location_dest_id.usage != 'internal':
currency = partner.property_product_pricelist.currency_id.id
@@ -115,12 +116,11 @@ class stock_move(osv.osv):
if context is None:
context = {}
if type in ('in_invoice', 'in_refund'):
- if move_line.partner_id:
+ if move_line.price_unit:
return move_line.price_unit
else:
- # Take the user company and pricetype
- # TODO: This intercompany still needed?
- product = move_line.product_id.with_context(currency_id=move_line.company_id.currency_id.id)
+ # Take the company of the move line
+ product = move_line.product_id.with_context(company_id=move_line.company_id.id)
amount_unit = product.price_get('standard_price')[move_line.product_id.id]
return amount_unit
else:
@@ -129,7 +129,7 @@ class stock_move(osv.osv):
pricelist_obj = self.pool.get("product.pricelist")
pricelist = move_line.partner_id.property_product_pricelist.id
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,
'date': move_line.date,
})[pricelist]
@@ -206,7 +206,7 @@ class stock_picking(osv.osv):
("2binvoiced", "To Be Invoiced"),
("none", "Not Applicable")
], string="Invoice Control", required=True,
- fnct_inv = _set_inv_state,
+ #fnct_inv = _set_inv_state,
store={
'stock.picking': (lambda self, cr, uid, ids, c={}: ids, ['state'], 10),
'stock.move': (__get_picking_move, ['picking_id', 'invoice_state'], 10),