diff options
| author | ced <> | 2007-06-05 12:57:03 +0000 |
|---|---|---|
| committer | ced <> | 2007-06-05 12:57:03 +0000 |
| commit | c8ffed812a44d25fa2c5e2e5863c121da4b854cd (patch) | |
| tree | ce696153bf493be1e8b3aa23e9d8c8afff6635fa | |
| parent | b1a5b029a73dd2ac3d508dedcf33ab1e7c71bdcd (diff) | |
ACCOUNT, HRTIMESHEET, HRTIMESHEET_INVOICE: improve state of analytic account
Move state into account module
Add domain for state in timesheet
bzr revid: ced-b912e6ed491cc0749682177b26d13c083aee3932
| -rw-r--r-- | addons/account/project/project.py | 2 | ||||
| -rw-r--r-- | addons/hr_timesheet/hr_timesheet.py | 3 | ||||
| -rw-r--r-- | addons/hr_timesheet/hr_timesheet_view.xml | 4 | ||||
| -rw-r--r-- | addons/hr_timesheet_invoice/hr_timesheet_invoice.py | 9 |
4 files changed, 6 insertions, 12 deletions
diff --git a/addons/account/project/project.py b/addons/account/project/project.py index bc76d84f6f5..a96842ab315 100644 --- a/addons/account/project/project.py +++ b/addons/account/project/project.py @@ -143,6 +143,7 @@ class account_analytic_account(osv.osv): 'stats_ids': fields.one2many('report.hr.timesheet.invoice.journal', 'account_id', string='Statistics', readonly=True), 'company_id': fields.many2one('res.company', 'Company', required=True), 'company_currency_id': fields.function(_get_company_currency, method=True, type='many2one', relation='res.currency', string='Currency'), + 'state': fields.selection([('draft','Draft'), ('open','Open'), ('pending','Pending'), ('close','Close'),], 'State', required=True), } def _default_company(self, cr, uid, context={}): @@ -154,6 +155,7 @@ class account_analytic_account(osv.osv): 'active' : lambda *a : True, 'type' : lambda *a : 'normal', 'company_id': _default_company, + 'state' : lambda *a : 'draft', } _order = 'parent_id desc,code' diff --git a/addons/hr_timesheet/hr_timesheet.py b/addons/hr_timesheet/hr_timesheet.py index 3fb471f18b1..10653767da7 100644 --- a/addons/hr_timesheet/hr_timesheet.py +++ b/addons/hr_timesheet/hr_timesheet.py @@ -92,7 +92,8 @@ class hr_analytic_timesheet(osv.osv): a = emp.product_id.product_tmpl_id.property_account_income if not a: a = emp.product_id.categ_id.property_account_income_categ - return a[0] + if a: + return a[0] return False def _getAnalyticJournal(self, cr, uid, context): diff --git a/addons/hr_timesheet/hr_timesheet_view.xml b/addons/hr_timesheet/hr_timesheet_view.xml index 74bcf4b6c5f..7529c80bbdb 100644 --- a/addons/hr_timesheet/hr_timesheet_view.xml +++ b/addons/hr_timesheet/hr_timesheet_view.xml @@ -9,7 +9,7 @@ <tree string="Timesheet Line" editable="bottom"> <field name="user_id" required="1"/> <field name="date" /> - <field name="account_id" on_change="on_change_account_id(account_id)" domain="[('type','=','normal')]"/> + <field name="account_id" on_change="on_change_account_id(account_id)" domain="[('type','=','normal'),('state', '<>', 'close')]"/> <field name="name" /> <field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, product_uom_id)" /> <field name="product_id" required="1"/> @@ -33,7 +33,7 @@ <field name="product_id" on_change="on_change_unit_amount(product_id, unit_amount, product_uom_id)" required="1"/> <field name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, product_uom_id)" /> - <field name="account_id" on_change="on_change_account_id(account_id)" domain="[('type','=','normal')]" select="1"/> + <field name="account_id" on_change="on_change_account_id(account_id)" domain="[('type','=','normal'),('state', '<>', 'close')]" select="1"/> <field name="amount" select="2"/> <field name="general_account_id" select="2"/> <field name="journal_id"/> diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py index b1fcaea831a..ae14be6d500 100644 --- a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py +++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py @@ -63,15 +63,6 @@ class account_analytic_account(osv.osv): 'amount_max': fields.float('Max. Invoice Price'), 'amount_invoiced': fields.function(_invoiced_calc, method=True, string='Invoiced Amount'), 'to_invoice': fields.many2one('hr_timesheet_invoice.factor','Invoicing'), - 'state': fields.selection([ - ('draft','Draft'), - ('open','Open'), - ('pending','Pending'), - ('close','Close'), - ], 'State', required=True), - } - _defaults = { - 'state' : lambda *a : 'draft', } account_analytic_account() |
