[FIX] hr_expense: [V6-RC1] HR - Expenses: invoice to pay employee does not point to the employee partner
lp bug: https://launchpad.net/bugs/685314 fixed bzr revid: mra@mra-laptop-20101207110835-m1cd14rhxup1rbrz
This commit is contained in:
parent
ac89df664a
commit
fd73a9b5a5
|
@ -158,23 +158,23 @@ class hr_expense_expense(osv.osv):
|
|||
'invoice_line_tax_id': tax_id and [(6, 0, tax_id)] or False,
|
||||
'account_analytic_id': l.analytic_account.id,
|
||||
}))
|
||||
if not exp.employee_id.address_id:
|
||||
raise osv.except_osv(_('Error !'), _('The employee must have a working address'))
|
||||
acc = exp.employee_id.address_id.partner_id.property_account_payable.id
|
||||
payment_term_id = exp.employee_id.address_id.partner_id.property_payment_term.id
|
||||
if not exp.employee_id.address_home_id:
|
||||
raise osv.except_osv(_('Error !'), _('The employee must have a Home address'))
|
||||
acc = exp.employee_id.address_home_id.partner_id.property_account_payable.id
|
||||
payment_term_id = exp.employee_id.address_home_id.partner_id.property_payment_term.id
|
||||
inv = {
|
||||
'name': exp.name,
|
||||
'reference': sequence_obj.get(cr, uid, 'hr.expense.invoice'),
|
||||
'account_id': acc,
|
||||
'type': 'in_invoice',
|
||||
'partner_id': exp.employee_id.address_id.partner_id.id,
|
||||
'address_invoice_id': exp.employee_id.address_id.id,
|
||||
'address_contact_id': exp.employee_id.address_id.id,
|
||||
'partner_id': exp.employee_id.address_home_id.partner_id.id,
|
||||
'address_invoice_id': exp.employee_id.address_home_id.id,
|
||||
'address_contact_id': exp.employee_id.address_home_id.id,
|
||||
'origin': exp.name,
|
||||
'invoice_line': lines,
|
||||
'currency_id': exp.currency_id.id,
|
||||
'payment_term': payment_term_id,
|
||||
'fiscal_position': exp.employee_id.address_id.partner_id.property_account_position.id
|
||||
'fiscal_position': exp.employee_id.address_home_id.partner_id.property_account_position.id
|
||||
}
|
||||
if payment_term_id:
|
||||
to_update = invoice_obj.onchange_payment_term_date_invoice(cr, uid, [], payment_term_id, None)
|
||||
|
|
Loading…
Reference in New Issue