Amit Dodiya (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/6.0-opw-54103-ado into 
lp:openobject-addons/6.0.

Requested reviews:
  Naresh(OpenERP) (nch-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-54103-ado/+merge/86795

Hello,

[FIX] Making of invoice based on expense lines from expense sheet is not 
considering invoice factor as discount"

1). Create new expense sheet for employee.
2). Add expense line with account which has Reinvoice Costs.
3). Confirm it, approve it and create invoice.

It not considering the Reinvoice Cost as discount in Invoice.

Thanks,
Amit
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-54103-ado/+merge/86795
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.0-opw-54103-ado.
=== modified file 'hr_expense/hr_expense.py'
--- hr_expense/hr_expense.py	2011-06-02 05:14:55 +0000
+++ hr_expense/hr_expense.py	2011-12-23 10:52:42 +0000
@@ -129,6 +129,7 @@
         sequence_obj = self.pool.get('ir.sequence')
         analytic_journal_obj = self.pool.get('account.analytic.journal')
         account_journal = self.pool.get('account.journal')
+        discount = 0.0
         for exp in self.browse(cr, uid, ids):
             lines = []
             for l in exp.line_ids:
@@ -142,11 +143,15 @@
                     acc = property_obj.get(cr, uid, 'property_account_expense_categ', 'product.category')
                     if not acc:
                         raise osv.except_osv(_('Error !'), _('Please configure Default Expense account for Product purchase, `property_account_expense_categ`'))
+                    
+                if 'to_invoice' in l.analytic_account :
+                    discount = l.analytic_account.to_invoice.factor
 
                 lines.append((0, False, {
                     'name': l.name,
                     'account_id': acc.id,
                     'price_unit': l.unit_amount,
+                    'discount': discount,
                     'quantity': l.unit_quantity,
                     'uos_id': l.uom_id.id,
                     'product_id': l.product_id and l.product_id.id or False,

=== modified file 'hr_timesheet_invoice/wizard/hr_timesheet_final_invoice_create.py'
--- hr_timesheet_invoice/wizard/hr_timesheet_final_invoice_create.py	2011-04-21 07:51:29 +0000
+++ hr_timesheet_invoice/wizard/hr_timesheet_final_invoice_create.py	2011-12-23 10:52:42 +0000
@@ -147,7 +147,7 @@
             curr_line = {
                 'price_unit': account.amount_max - amount_total,
                 'quantity': 1.0,
-                'discount': 0.0,
+                'discount': account.to_invoice.factor,
                 'invoice_line_tax_id': [(6,0,tax)],
                 'invoice_id': last_invoice,
                 'name': product.name,

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to