summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorCedric Snauwaert <csn@openerp.com>2013-09-13 11:38:15 +0200
committerCedric Snauwaert <csn@openerp.com>2013-09-13 11:38:15 +0200
commit212be5e67caf149aa1f9f2fccdd832ebfe5d94d1 (patch)
treefec06ef8b41b6f1296a462048ca2af261d48335d /addons
parent0b92f7e1505892a1444fb44e7ce9466e4982b423 (diff)
[WIP]fix sale workflow in the case we only have sale and not stock installed.
bzr revid: csn@openerp.com-20130913093815-m6luad9cnhykbcha
Diffstat (limited to 'addons')
-rw-r--r--addons/project_mrp/project_mrp.py3
-rw-r--r--addons/sale/sale.py15
-rw-r--r--addons/sale_stock/sale_stock.py7
3 files changed, 21 insertions, 4 deletions
diff --git a/addons/project_mrp/project_mrp.py b/addons/project_mrp/project_mrp.py
index b4052509e38..231132a7e27 100644
--- a/addons/project_mrp/project_mrp.py
+++ b/addons/project_mrp/project_mrp.py
@@ -152,6 +152,9 @@ class product_product(osv.osv):
class sale_order(osv.osv):
_inherit = 'sale.order'
+ def _can_create_procurement(self, cr, uid, ids, context=None):
+ return True
+
def _prepare_order_line_procurement(self, cr, uid, order, line, group_id=False, context=None):
proc_data = super(sale_order, self)._prepare_order_line_procurement(cr,
uid, order, line, group_id = group_id, context=context)
diff --git a/addons/sale/sale.py b/addons/sale/sale.py
index 2b479442597..40e699009de 100644
--- a/addons/sale/sale.py
+++ b/addons/sale/sale.py
@@ -653,6 +653,9 @@ class sale_order(osv.osv):
def _check_create_procurement(self, cr, uid, order, line, context=None):
return True
+ def _can_create_procurement(self, cr, uid, ids, context=None):
+ return False
+
def action_ship_create(self, cr, uid, ids, context=None):
"""Create the required procurements to supply sales order lines, also connecting
the procurements to appropriate stock moves in order to bring the goods to the
@@ -678,9 +681,8 @@ class sale_order(osv.osv):
vals = self._prepare_order_line_procurement(cr, uid, order, line, group_id=group_id, context=context)
proc_id = procurement_obj.create(cr, uid, vals, context=context)
proc_ids.append(proc_id)
-
- #Confirm procurement order such that rules will be applied on it
- procurement_obj.run(cr, uid, proc_ids, context=context)
+ #Confirm procurement order such that rules will be applied on it
+ procurement_obj.run(cr, uid, proc_ids, context=context)
# FP NOTE: do we need this? isn't it the workflow that should set this
val = {}
if order.state == 'shipping_except':
@@ -713,7 +715,14 @@ class sale_order(osv.osv):
canceled = False
write_done_ids = []
write_cancel_ids = []
+ if not self._can_create_procurement(cr, uid, ids, context={}):
+ for order in self.browse(cr, uid, ids, context={}):
+ for line in order.order_line:
+ write_done_ids.append(line.id)
+ self.pool.get('sale.order.line').write(cr, uid, write_done_ids, {'state': 'done'})
+ return True
for order in self.browse(cr, uid, ids, context={}):
+
#TODO: Need to rethink what happens when cancelling
for line in order.order_line:
states = [x.state for x in line.procurement_ids]
diff --git a/addons/sale_stock/sale_stock.py b/addons/sale_stock/sale_stock.py
index da134a3a520..0942980aaf5 100644
--- a/addons/sale_stock/sale_stock.py
+++ b/addons/sale_stock/sale_stock.py
@@ -30,6 +30,10 @@ from openerp import SUPERUSER_ID
class sale_order(osv.osv):
_inherit = "sale.order"
+
+ def _can_create_procurement(self, cr, uid, ids, context=None):
+ return True
+
def copy(self, cr, uid, id, default=None, context=None):
if not default:
default = {}
@@ -157,6 +161,7 @@ class sale_order(osv.osv):
})
return result
+
# TODO: FP Note: I guess it's better to do:
# if order_policy<>picking: super()
# else: call invoice_on_picking_method()
@@ -402,4 +407,4 @@ class stock_move(osv.osv):
res['account_analytic_id'] = sale_line.order_id.project_id and sale_line.order_id.project_id.id or False
res['price_unit'] = sale_line.price_unit
res['discount'] = sale_line.discount
- return res
+ return res \ No newline at end of file