HR_EXPENSE: add sequence, invoice role and fix force journal

bzr revid: ced-977efeb32088ebc2c9b7571242c126b531b2dddd
This commit is contained in:
ced
2007-04-19 06:59:35 +00:00
parent 7f938360c7
commit 0602ce785c
4 changed files with 24 additions and 4 deletions
+1 -1
View File
@@ -9,7 +9,7 @@
"init_xml" : [],
"demo_xml" : [],
#"demo_xml" : ["hr_expense_demo.xml", "hr.expense.expense.csv"],
"update_xml" : ["hr_expense_workflow.xml", "hr_expense_view.xml", "hr_expense_report.xml"],
"update_xml" : ["hr_expense_sequence.xml", "hr_expense_workflow.xml", "hr_expense_view.xml", "hr_expense_report.xml",],
"active": False,
"installable": True
}
+3 -2
View File
@@ -135,7 +135,7 @@ class hr_expense_expense(osv.osv):
acc = exp.employee_id.address_id.partner_id.property_account_payable[0]
inv = {
'name': exp.name,
'reference': "EMP%dEXP%d" % (exp.employee_id.id, exp.id),
'reference': self.pool.get('ir.sequence').get(cr, uid, 'hr.expense.invoice'),
'account_id': acc,
'type': 'in_invoice',
'partner_id': exp.employee_id.address_id.partner_id.id,
@@ -144,8 +144,9 @@ class hr_expense_expense(osv.osv):
'origin': exp.name,
'invoice_line': lines,
'price_type': 'tax_included',
'journal_id': exp.journal_id and exp.journal_id.id or False,
}
if exp.journal_id:
inv['journal_id']=exp.journal_id.id
inv_id = self.pool.get('account.invoice').create(cr, uid, inv, {'type':'in_invoice'})
self.write(cr, uid, [exp.id], {'invoice_id': inv_id, 'state': 'invoiced'})
res = inv_id
+15
View File
@@ -0,0 +1,15 @@
<?xml version="1.0"?>
<terp>
<data noupdate="1">
<record model="ir.sequence.type" id="seq_type_hr_expense_invoice">
<field name="name">Expense invoice</field>
<field name="code">hr.expense.invoice</field>
</record>
<record model="ir.sequence" id="seq_hr_expense_invoice">
<field name="name">Expense invoice</field>
<field name="code">hr.expense.invoice</field>
<field name="prefix">EXP/</field>
<field name="padding">3</field>
</record>
</data>
</terp>
+5 -1
View File
@@ -8,6 +8,10 @@
<field name="name">Human Resources - Expenses</field>
</record>
<record model="res.roles" id="HR_INV">
<field name="name">Human Resources - Expenses invoice</field>
</record>
<!-- Workflow definition -->
<record model="workflow" id="wkf_expenses">
@@ -100,7 +104,7 @@
<field name="act_from" ref="act_accepted" />
<field name="act_to" ref="act_invoice" />
<field name="signal">invoice</field>
<field name="role_id" ref="HR"/>
<field name="role_id" ref="HR_INV"/>
</record>
<record model="workflow.transition" id="t9">
<field name="act_from" ref="act_invoice" />