[FIX] sale: in create invoice wizard, reintroduce field qtty (used in tests)

bzr revid: rco@openerp.com-20120723161426-rwk22j4tm71z863b
This commit is contained in:
Raphael Collet 2012-07-23 18:14:26 +02:00
parent 396f5fdc9e
commit 0e681f8f5e
3 changed files with 7 additions and 4 deletions

View File

@ -16,7 +16,7 @@
ctx = context.copy()
ctx.update({"active_model": 'sale.order', "active_ids": [ref("order4")], "active_id":ref("order4")})
order_line = self.pool.get('sale.order.line').browse(cr, uid, ref("line7"), context=context)
pay_id = self.create(cr, uid, {'product_id': order_line.product_id.id, 'amount': order_line.price_subtotal, 'qtty': order_line.product_uom_qty})
pay_id = self.create(cr, uid, {'advance_payment_method': 'fixed', 'product_id': order_line.product_id.id, 'amount': order_line.price_subtotal, 'qtty': order_line.product_uom_qty})
self.create_invoices(cr, uid, [pay_id], context=ctx)
-
I check Invoice which made advance

View File

@ -35,6 +35,7 @@ class sale_advance_payment_inv(osv.osv_memory):
Use Percentage to invoice a percentage of the total amount.
Use Fixed Price to invoice a specific amound in advance.
Use Some Order Lines to invoice a selection of the sale order lines."""),
'qtty': fields.float('Quantity', digits=(16, 2), required=True),
'product_id': fields.many2one('product.product', 'Advance Product',
help="""Select a product of type service which is called 'Advance Product'.
You may have to create it and set it as a default value on this field."""),
@ -52,6 +53,7 @@ class sale_advance_payment_inv(osv.osv_memory):
_defaults = {
'advance_payment_method': 'all',
'qtty': 1.0,
'product_id': _get_advance_product,
}
@ -149,7 +151,7 @@ class sale_advance_payment_inv(osv.osv_memory):
'name': res.get('name'),
'account_id': res['account_id'],
'price_unit': inv_amount,
'quantity': 1.0,
'quantity': wizard.qtty or 1.0,
'discount': False,
'uos_id': res.get('uos_id', False),
'product_id': wizard.product_id.id,
@ -183,8 +185,8 @@ class sale_advance_payment_inv(osv.osv_memory):
'order_id': sale.id,
'name': res.get('name'),
'price_unit': -inv_amount,
'product_uom_qty': 1.0,
'product_uos_qty': 1.0,
'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.product_id.id or False,

View File

@ -10,6 +10,7 @@
<group>
<field name="advance_payment_method"
on_change="onchange_method(advance_payment_method, product_id)"/>
<field name="qtty" invisible="1"/>
<field name="product_id"
on_change="onchange_method(advance_payment_method, product_id)"
context="{'search_default_services': 1}"