From b38138d555ddcaab48f8efc3e8efd799fbb9320d Mon Sep 17 00:00:00 2001 From: Josse Colpaert Date: Fri, 30 Aug 2013 17:12:01 +0200 Subject: [PATCH] [IMP] Invoice_state on procurement order should be defined in stock_account bzr revid: jco@openerp.com-20130830151201-6xwnaxymdynaja7h --- addons/sale/sale.py | 6 ------ addons/stock/stock.py | 3 ++- addons/stock_account/stock.py | 9 ++++++++- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 6535ed7bc6d..b849c7d62c1 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -1072,12 +1072,6 @@ class procurement_order(osv.osv): _inherit = 'procurement.order' _columns = { 'sale_line_id': fields.many2one('sale.order.line', string='Sale Order Line'), - 'invoice_state': fields.selection( - [ - ("invoiced", "Invoiced"), - ("2binvoiced", "To Be Invoiced"), - ("none", "Not Applicable") - ], "Invoice Control", required=True), } _defaults = { 'invoice_state': 'none', diff --git a/addons/stock/stock.py b/addons/stock/stock.py index d000d38b04a..5439d10d225 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -1623,10 +1623,11 @@ class stock_move(osv.osv): self.action_done(cr, uid, res, context=context) return res + + def split(self, cr, uid, move, qty, context=None): """ Splits qty from move move into a new move - It will check if it can propagate the split """ if move.product_qty==qty: return move.id diff --git a/addons/stock_account/stock.py b/addons/stock_account/stock.py index 312b1668f6d..a06f00d93a3 100644 --- a/addons/stock_account/stock.py +++ b/addons/stock_account/stock.py @@ -42,10 +42,17 @@ class procurement_rule(osv.osv): class procurement_order(osv.osv): _inherit = "procurement.order" + _columns = { + 'invoice_state': fields.selection( + [("invoiced", "Invoiced"), + ("2binvoiced", "To Be Invoiced"), + ("none", "Not Applicable") + ], "Invoice Control", required=True), + } def _run_move_create(self, cr, uid, procurement, context=None): res = super(procurement_order, self)._run_move_create(cr, uid, procurement, context=context) - res.update({'invoice_state': procurement.rule_id.invoice_state in ('none', False) and procurement.invoice_state or procurement.rule_id.invoice_state }) + res.update({'invoice_state': (procurement.rule_id.invoice_state in ('none', False) and procurement.invoice_state or procurement.rule_id.invoice_state) or 'none'}) return res