ACCOUNT, HRTIMESHEET, HRTIMESHEET_INVOICE: improve state of analytic account
Move state into account module Add domain for state in timesheet bzr revid: ced-b912e6ed491cc0749682177b26d13c083aee3932
This commit is contained in:
parent
b1a5b029a7
commit
c8ffed812a
|
@ -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),
|
'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_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'),
|
'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={}):
|
def _default_company(self, cr, uid, context={}):
|
||||||
|
@ -154,6 +155,7 @@ class account_analytic_account(osv.osv):
|
||||||
'active' : lambda *a : True,
|
'active' : lambda *a : True,
|
||||||
'type' : lambda *a : 'normal',
|
'type' : lambda *a : 'normal',
|
||||||
'company_id': _default_company,
|
'company_id': _default_company,
|
||||||
|
'state' : lambda *a : 'draft',
|
||||||
}
|
}
|
||||||
|
|
||||||
_order = 'parent_id desc,code'
|
_order = 'parent_id desc,code'
|
||||||
|
|
|
@ -92,7 +92,8 @@ class hr_analytic_timesheet(osv.osv):
|
||||||
a = emp.product_id.product_tmpl_id.property_account_income
|
a = emp.product_id.product_tmpl_id.property_account_income
|
||||||
if not a:
|
if not a:
|
||||||
a = emp.product_id.categ_id.property_account_income_categ
|
a = emp.product_id.categ_id.property_account_income_categ
|
||||||
return a[0]
|
if a:
|
||||||
|
return a[0]
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def _getAnalyticJournal(self, cr, uid, context):
|
def _getAnalyticJournal(self, cr, uid, context):
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<tree string="Timesheet Line" editable="bottom">
|
<tree string="Timesheet Line" editable="bottom">
|
||||||
<field name="user_id" required="1"/>
|
<field name="user_id" required="1"/>
|
||||||
<field name="date" />
|
<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="name" />
|
||||||
<field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, product_uom_id)" />
|
<field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, product_uom_id)" />
|
||||||
<field name="product_id" required="1"/>
|
<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_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="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="amount" select="2"/>
|
||||||
<field name="general_account_id" select="2"/>
|
<field name="general_account_id" select="2"/>
|
||||||
<field name="journal_id"/>
|
<field name="journal_id"/>
|
||||||
|
|
|
@ -63,15 +63,6 @@ class account_analytic_account(osv.osv):
|
||||||
'amount_max': fields.float('Max. Invoice Price'),
|
'amount_max': fields.float('Max. Invoice Price'),
|
||||||
'amount_invoiced': fields.function(_invoiced_calc, method=True, string='Invoiced Amount'),
|
'amount_invoiced': fields.function(_invoiced_calc, method=True, string='Invoiced Amount'),
|
||||||
'to_invoice': fields.many2one('hr_timesheet_invoice.factor','Invoicing'),
|
'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()
|
account_analytic_account()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue