FIX hr_holidays_lunch_voucher and hr_holidays_lunch_voucher_natixis
This commit is contained in:
@@ -11,4 +11,5 @@ class PurchaseConfigSettings(models.TransientModel):
|
||||
lunch_voucher_product_id = fields.Many2one(
|
||||
related='company_id.lunch_voucher_product_id')
|
||||
lunch_voucher_employer_price = fields.Monetary(
|
||||
related='company_id.lunch_voucher_employer_price')
|
||||
related='company_id.lunch_voucher_employer_price',
|
||||
currency_field='company_currency_id')
|
||||
|
||||
@@ -18,7 +18,7 @@ class LunchVoucherPurchase(models.TransientModel):
|
||||
raise UserError(_(
|
||||
"Lunch Voucher Product not configured on company %s")
|
||||
% company.name)
|
||||
if not company.lunch_voucher_product_id.seller_id:
|
||||
if not company.lunch_voucher_product_id.seller_ids:
|
||||
raise UserError(_(
|
||||
"Missing supplier on Product '%s'.")
|
||||
% company.lunch_voucher_product_id.name)
|
||||
@@ -44,7 +44,7 @@ class LunchVoucherPurchase(models.TransientModel):
|
||||
% lvoucher.employee_id.name)
|
||||
total_qty += lvoucher.qty
|
||||
|
||||
supplier = company.lunch_voucher_product_id.seller_ids[0]
|
||||
supplier = company.lunch_voucher_product_id.seller_ids[0].name
|
||||
pick_type_id = poo.default_get(['picking_type_id'])['picking_type_id']
|
||||
vals = {'picking_type_id': pick_type_id, 'partner_id': supplier.id}
|
||||
vals = poo.play_onchanges(vals, ['picking_type_id'])
|
||||
@@ -55,7 +55,6 @@ class LunchVoucherPurchase(models.TransientModel):
|
||||
'order_id': vals, 'product_qty': total_qty}
|
||||
lvals = polo.play_onchanges(lvals, ['product_id'])
|
||||
# TODO check lvals['taxes_id'] uses (6, 0, ...)
|
||||
print "lvals=", lvals
|
||||
lvals.pop('order_id')
|
||||
vals['order_line'] = [(0, 0, lvals)]
|
||||
po = poo.create(vals)
|
||||
|
||||
@@ -46,14 +46,16 @@ class LunchVoucherPurchase(models.TransientModel):
|
||||
"Lunch Voucher Employer Price not set on company '%s'.")
|
||||
% company.name)
|
||||
if float_is_zero(
|
||||
company.lunch_voucher_product_id.standard_price,
|
||||
company.lunch_voucher_product_id.seller_ids[0].price,
|
||||
precision_digits=2):
|
||||
raise UserError(_(
|
||||
"Lunch Voucher Standard Price is not set on product '%s'.")
|
||||
"Lunch Voucher Price on supplier info is not set "
|
||||
"on product '%s'.")
|
||||
% company.lunch_voucher_product_id.display_name)
|
||||
lvouchers = lvao.browse(self._context['active_ids'])
|
||||
of = u''
|
||||
tmp = {}
|
||||
price = company.lunch_voucher_product_id.seller_ids[0].price
|
||||
for lvoucher in lvouchers:
|
||||
if lvoucher.qty > 0:
|
||||
if lvoucher.qty not in tmp:
|
||||
@@ -70,8 +72,7 @@ class LunchVoucherPurchase(models.TransientModel):
|
||||
unicode(pack_qty).zfill(3),
|
||||
unicode(vouchers_per_pack).zfill(2),
|
||||
unicode(pack_qty * vouchers_per_pack).zfill(5),
|
||||
'{:05.2f}'.format(
|
||||
company.lunch_voucher_product_id.standard_price),
|
||||
'{:05.2f}'.format(price),
|
||||
'{:05.2f}'.format(company.lunch_voucher_employer_price),
|
||||
' ' * 64)
|
||||
of += line
|
||||
|
||||
Reference in New Issue
Block a user