diff --git a/addons/account_voucher/voucher_sales_purchase_view.xml b/addons/account_voucher/voucher_sales_purchase_view.xml index e70156e4032..832ea3942f1 100644 --- a/addons/account_voucher/voucher_sales_purchase_view.xml +++ b/addons/account_voucher/voucher_sales_purchase_view.xml @@ -219,7 +219,7 @@ account.voucher form -
+
@@ -109,14 +110,21 @@
- - + +
+ + +
+ + + +
- - + + diff --git a/addons/hr_expense/hr_expense_workflow.xml b/addons/hr_expense/hr_expense_workflow.xml index 328a07879a4..2e085071207 100644 --- a/addons/hr_expense/hr_expense_workflow.xml +++ b/addons/hr_expense/hr_expense_workflow.xml @@ -32,14 +32,6 @@ expense_accept() - - - paid - function - expense_paid() - True - - refused @@ -47,12 +39,11 @@ expense_canceled() - + - invoice - subflow - - action_invoice_create() + done + function + action_receipt_create() @@ -91,15 +82,8 @@ - - invoice - - - - - - - subflow.paid + + done diff --git a/addons/hr_expense/report/hr_expense_report.py b/addons/hr_expense/report/hr_expense_report.py index adef11f5269..72bf710ec4f 100644 --- a/addons/hr_expense/report/hr_expense_report.py +++ b/addons/hr_expense/report/hr_expense_report.py @@ -39,11 +39,10 @@ class hr_expense_report(osv.osv): 'product_id':fields.many2one('product.product', 'Product', readonly=True), 'journal_id': fields.many2one('account.journal', 'Force Journal', readonly=True), 'product_qty':fields.float('Qty', readonly=True), - 'invoiced':fields.integer('# of Invoiced Lines', readonly=True), 'employee_id': fields.many2one('hr.employee', "Employee's Name", readonly=True), 'date_confirm': fields.date('Confirmation Date', readonly=True), 'date_valid': fields.date('Validation Date', readonly=True), - 'invoice_id': fields.many2one('account.invoice', 'Invoice', readonly=True), + 'voucher_id': fields.many2one('account.voucher', 'Receipt', readonly=True), 'department_id':fields.many2one('hr.department','Department', readonly=True), 'company_id':fields.many2one('res.company', 'Company', readonly=True), 'user_id':fields.many2one('res.users', 'Validation User', readonly=True), @@ -60,8 +59,7 @@ class hr_expense_report(osv.osv): ('draft', 'Draft'), ('confirm', 'Waiting confirmation'), ('accepted', 'Accepted'), - ('invoiced', 'Invoiced'), - ('paid', 'Reimbursed'), + ('done', 'Done'), ('cancelled', 'Cancelled')], 'Status', readonly=True), } @@ -78,8 +76,7 @@ class hr_expense_report(osv.osv): s.currency_id, to_date(to_char(s.date_confirm, 'dd-MM-YYYY'),'dd-MM-YYYY') as date_confirm, to_date(to_char(s.date_valid, 'dd-MM-YYYY'),'dd-MM-YYYY') as date_valid, - s.invoice_id, - count(s.invoice_id) as invoiced, + s.voucher_id, s.user_valid as user_id, s.department_id, to_char(date_trunc('day',s.create_date), 'YYYY') as year, @@ -109,7 +106,7 @@ class hr_expense_report(osv.osv): to_date(to_char(s.date_valid, 'dd-MM-YYYY'),'dd-MM-YYYY'), l.product_id, l.analytic_account, - s.invoice_id, + s.voucher_id, s.currency_id, s.user_valid, s.department_id, diff --git a/addons/hr_expense/report/hr_expense_report_view.xml b/addons/hr_expense/report/hr_expense_report_view.xml index 7877edf4b3a..8f20766fa8b 100644 --- a/addons/hr_expense/report/hr_expense_report_view.xml +++ b/addons/hr_expense/report/hr_expense_report_view.xml @@ -7,13 +7,13 @@ hr.expense.report tree - + - + @@ -23,7 +23,6 @@ - @@ -56,8 +55,6 @@ help = "Confirm Expenses"/> - diff --git a/addons/hr_expense/test/expense_process.yml b/addons/hr_expense/test/expense_process.yml index 5c8a9d53f7c..af4d5aaec37 100644 --- a/addons/hr_expense/test/expense_process.yml +++ b/addons/hr_expense/test/expense_process.yml @@ -17,33 +17,21 @@ !assert {model: hr.expense.expense, id: sep_expenses, severity: error, string: Expense should be in Approved state}: - state == 'accepted' - - I make Invoice for the expense. + I make Receipt for the expense. - - !python {model: hr.expense.expense}: | - self.invoice(cr, uid, [ref('sep_expenses')]) + !workflow {model: hr.expense.expense, action: done, ref: sep_expenses} - - I check invoice details. + I check receipt details. - !python {model: hr.expense.expense}: | sep_expenses = self.browse(cr, uid, ref("sep_expenses"), context=context) - assert sep_expenses.state == 'invoiced', "Expense should be in 'Invoiced' state." - assert sep_expenses.invoice_id, "Expense should have link of Invoice." - assert sep_expenses.invoice_id.currency_id == sep_expenses.currency_id,"Invoice currency is not correspond with supplier invoice currency" - assert sep_expenses.invoice_id.origin == sep_expenses.name,"Invoice origin is not correspond with supplier invoice" - assert sep_expenses.invoice_id.type == 'in_invoice', "Invoice type is not supplier invoice" - assert sep_expenses.invoice_id.amount_total == sep_expenses.amount,"Invoice total amount is not correspond with supplier invoice total" - assert len(sep_expenses.invoice_id.invoice_line) == len(sep_expenses.line_ids),"Lines of Invoice and supplier invoice Line are not correspond" - #TODO: check invoice line details with Expenses lines -- - I pay the expenses. -- - !python {model: hr.expense.expense}: | - self.expense_paid(cr, uid, [ref('sep_expenses')]) -- - I check that state of expenses is 'Paid'. -- - !assert {model: hr.expense.expense, id: sep_expenses, severity: error, string: Expense should be in Paid state}: - - state == 'paid' + assert sep_expenses.state == 'done', "Expense should be in 'Done' state." + assert sep_expenses.voucher_id, "Expense should have link of Purchase Receipt." + assert sep_expenses.voucher_id.name == sep_expenses.name,"Receipt name is not correspond with expense name." + assert sep_expenses.voucher_id.type == 'purchase', "Receipt type is not purchase receipt." + assert sep_expenses.voucher_id.amount == sep_expenses.amount,"Receipt total amount is not correspond with expense total." + assert len(sep_expenses.voucher_id.line_dr_ids) == len(sep_expenses.line_ids),"Lines of Receipt and expense line are not correspond." + - I duplicate the expenses and cancel duplicated. -