Non-declared variable in sale_stock.py gives error
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Addons (MOVED TO GITHUB) |
Confirmed
|
Medium
|
OpenERP R&D Addons Team 2 |
Bug Description
Based on rev 9242,
sale_stock.py --> at the bottom end method _create_invoices(), I found that 2 variables are not declared, --> inv_amount and res.
In normal case, when sale.order_policy == 'picking', this method will not be used. So far, no problem.
Somehow, I write my own addons, which use this method on order_policy = picking, gives error (as variables are not declared).
May be the code need re-factoring??
=======
class sale_advance_
_inherit = "sale.advance.
def _create_
result = super(sale_
sale_obj = self.pool.
wizard = self.browse(cr, uid, [result], context)
sale = sale_obj.browse(cr, uid, sale_id, context=context)
if sale.order_policy == 'postpaid':
raise osv.except_osv(
# kittiu: seem to be a bug as inv_amoutn is not declared. And in normal case, this part is not used, so I delete them.
# # If invoice on picking: add the cost on the SO
# # If not, the advance will be deduced when generating the final invoice
# line_name = inv_values.
# line_tax = inv_values.
# if sale.order_policy == 'picking':
# vals = {
# 'order_id': sale.id,
# 'name': line_name,
# 'price_unit': -inv_amount,
# 'product_uom_qty': wizard.qtty or 1.0,
# 'product_uos_qty': wizard.qtty or 1.0,
# 'product_uos': res.get('uos_id', False),
# 'product_uom': res.get('uom_id', False),
# 'product_id': wizard.
# 'discount': False,
# 'tax_id': line_tax,
# }
# sale_line_
# -- kittiu:
return result
Changed in openobject-addons: | |
assignee: | OpenERP R&D Addons Team 3 (openerp-dev-addons3) → OpenERP R&D Addons Team 2 (openerp-dev-addons2) |
Hello,
It will gives error when you customized the code.
Thank you!