From 6c58c27ae54d6d246eaf3ccd86d55dcf0ec0d3bd Mon Sep 17 00:00:00 2001 From: "hda@tinyerp.com" <> Date: Mon, 15 Sep 2008 18:09:01 +0530 Subject: [PATCH 1/2] Bugfix for context bzr revid: hda@tinyerp.com-20080915123901-5t2ymiyy1ki15xrk --- addons/sale/sale.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 6f3336f2c3c..81c0c6c6230 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -301,7 +301,7 @@ class sale_order(osv.osv): def _inv_get(self, cr, uid, order, context={}): return {} - def _make_invoice(self, cr, uid, order, lines): + def _make_invoice(self, cr, uid, order, lines, context={}): a = order.partner_id.property_account_receivable.id if order.payment_term: pay_term = order.payment_term.id @@ -781,7 +781,7 @@ class sale_order_line(osv.osv): if not product: return {'value': {'th_weight' : 0, 'product_packaging': False, 'product_uos_qty': qty}, 'domain': {'product_uom': [], - 'product_uos': []}} + 'product_uos': []}} if not date_order: date_order = time.strftime('%Y-%m-%d') @@ -793,7 +793,7 @@ class sale_order_line(osv.osv): pack = self.pool.get('product.packaging').browse(cr, uid, packaging, context) q = product_uom_obj._compute_qty(cr, uid, uom, pack.qty, default_uom) qty = qty - qty % q + q - result['product_uom_qty'] = qty + result['product_uom_qty'] = qty if uom: uom2 = product_uom_obj.browse(cr, uid, uom) @@ -884,7 +884,7 @@ class sale_order_line(osv.osv): 'message': "Couldn't find a pricelist line matching this product and quantity.\n" "You have to change either the product, the quantity or the pricelist." - } + } else: result.update({'price_unit': price}) From 28475989d6293c36195ea420f8118ee1db6e11e4 Mon Sep 17 00:00:00 2001 From: Amit Mendapara Date: Tue, 16 Sep 2008 11:45:30 +0530 Subject: [PATCH 2/2] Improved process.graph_get bzr revid: ame@tinyerp.com-20080916061530-meovcp72vgkhr4n8 --- addons/process/process.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/addons/process/process.py b/addons/process/process.py index cff0a1fb22d..88e6e8ef8b4 100644 --- a/addons/process/process.py +++ b/addons/process/process.py @@ -45,11 +45,11 @@ class process_process(osv.osv): } def graph_get(self, cr, uid, id, res_model, res_id, scale, context): - - current_object = res_model + pool = pooler.get_pool(cr.dbname) process = pool.get('process.process').browse(cr, uid, [id])[0] + current_object = pool.get(res_model).browse(cr, uid, [res_id])[0] nodes = {} start = [] @@ -61,6 +61,21 @@ class process_process(osv.osv): data['name'] = node.name data['menu'] = node.menu_id.name data['model'] = node.model_id.model + data['kind'] = node.kind + data['active'] = 0 + + if node.kind == "state" and node.model_id.model == res_model: + states = node.model_states + states = (states or []) and states.split(',') + data['active'] = (states and current_object.state in states) or not states + + elif node.kind == "router": + #TODO: + pass + + elif node.kind == "subflow": + #TODO: subflow + pass nodes[node.id] = data