diff --git a/addons/sale_stock/__openerp__.py b/addons/sale_stock/__openerp__.py index 070d132a61d..369eb8be60f 100644 --- a/addons/sale_stock/__openerp__.py +++ b/addons/sale_stock/__openerp__.py @@ -45,7 +45,7 @@ You can choose flexible invoicing methods: 'author': 'OpenERP SA', 'website': 'http://www.openerp.com', 'images': ['images/deliveries_to_invoice.jpeg'], - 'depends': ['sale', 'stock', 'procurement'], + 'depends': ['sale', 'stock_account', 'procurement'], 'init_xml': [], 'update_xml': ['security/sale_stock_security.xml', 'security/ir.model.access.csv', diff --git a/addons/stock_account/product.py b/addons/stock_account/product.py index 3f1d4b0b271..ed19dca2b43 100644 --- a/addons/stock_account/product.py +++ b/addons/stock_account/product.py @@ -186,7 +186,7 @@ class product_template(osv.osv): 'cost_method': fields.property(type='selection', selection=[('standard', 'Standard Price'), ('average', 'Average Price'), ('real', 'Real Price')], help="""Standard Price: The cost price is manually updated at the end of a specific period (usually every year) Average Price: The cost price is recomputed at each incoming shipment - Real Price: The cost price is calculated as the real price of the last outgoing shipment""", + Real Price: The cost price is calculated as the real price of each outgoing product""", string="Costing Method", required=True), 'property_stock_account_input': fields.property( type='many2one', diff --git a/addons/stock_account/stock_account.py b/addons/stock_account/stock_account.py index 58a8572214c..4ca3cda4647 100644 --- a/addons/stock_account/stock_account.py +++ b/addons/stock_account/stock_account.py @@ -73,7 +73,7 @@ class stock_quant(osv.osv): location_from: can be None if it's a new quant """ def _account_entry_move(self, cr, uid, quant, location_from, location_to, move, context=None): - if quant.product_id.valuation <> 'realtime': + if quant.product_id.valuation <> 'real_time': return False company_from = self._location_owner(cr, uid, quant, location_from, context=context) company_to = self._location_owner(cr, uid, quant, location_to, context=context) @@ -84,24 +84,24 @@ class stock_quant(osv.osv): account_moves = [] # Create Journal Entry for products arriving in the company if company_to: - if location_from.usage == 'customer': + if location_from and location_from.usage == 'customer': #goods returned from customer - account_moves += self._create_account_move_line(cr, uid, quant, acc_dest, acc_valuation, context=context) + account_moves += self._create_account_move_line(cr, uid, quant, move, acc_dest, acc_valuation, context=context) else: - account_moves += self._create_account_move_line(cr, uid, quant, acc_src, acc_valuation, context=context) + account_moves += self._create_account_move_line(cr, uid, quant, move, acc_src, acc_valuation, context=context) # Create Journal Entry for products leaving the company if company_from: - if location_to.usage == 'supplier': + if location_to and location_to.usage == 'supplier': #goods returned to supplier - account_moves += self._create_account_move_line(cr, uid, quant, acc_valuation, acc_src, context=context) + account_moves += self._create_account_move_line(cr, uid, quant, move, acc_valuation, acc_src, context=context) else: - account_moves += self._create_account_move_line(cr, uid, quant, acc_valuation, acc_dest, context=context) + account_moves += self._create_account_move_line(cr, uid, quant, move, acc_valuation, acc_dest, context=context) def move_single_quant(self, cr, uid, quant, qty, move, context=None): + location_from = quant and quant.location_id or False quant = super(stock_quant, self).move_single_quant(cr, uid, quant, qty, move, context=context) quant.refresh() - location_from = quant.location_id self._account_entry_move(cr, uid, quant, location_from, quant.location_id, move, context=context) return quant @@ -263,8 +263,8 @@ class stock_quant(osv.osv): debit_line_vals = { 'name': move.name, 'product_id': quant.product_id.id, - 'quantity': quant.product_qty, - 'product_uom_id': quant.product_id.product_uom.id, + 'quantity': quant.qty, + 'product_uom_id': quant.product_id.uom_id.id, 'ref': move.picking_id and move.picking_id.name or False, 'date': time.strftime('%Y-%m-%d'), 'partner_id': partner_id, @@ -274,8 +274,8 @@ class stock_quant(osv.osv): credit_line_vals = { 'name': move.name, 'product_id': quant.product_id.id, - 'quantity': quant.product_qty, - 'product_uom_id': quant.product_id.product_uom.id, + 'quantity': quant.qty, + 'product_uom_id': quant.product_id.uom_id.id, 'ref': move.picking_id and move.picking_id.name or False, 'date': time.strftime('%Y-%m-%d'), 'partner_id': partner_id,