[FIX] contract management: shortcut buttons on contract form view
bzr revid: qdp-launchpad@openerp.com-20120618155447-26rt90uvml410rwu
This commit is contained in:
parent
9b539bb9dd
commit
b9744fc4d9
|
@ -467,9 +467,11 @@ class account_analytic_account(osv.osv):
|
|||
if context is None:
|
||||
context = {}
|
||||
sale_ids = self.pool.get('sale.order').search(cr,uid,[('project_id','=',context.get('search_default_project_id',False)),('partner_id','=',context.get('search_default_partner_id',False))])
|
||||
names = [record.name for record in self.browse(cr, uid, ids, context=context)]
|
||||
name = _('Sale Order Lines of %s') % ','.join(names)
|
||||
return {
|
||||
'type': 'ir.actions.act_window',
|
||||
'name': _('Sale Order Lines'),
|
||||
'name': name,
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,form',
|
||||
'context': context,
|
||||
|
|
|
@ -127,37 +127,33 @@ class account_analytic_account(osv.osv):
|
|||
return res
|
||||
|
||||
def open_hr_expense(self, cr, uid, ids, context=None):
|
||||
account = self.browse(cr, uid, ids[0], context)
|
||||
data_obj = self.pool.get('ir.model.data')
|
||||
try:
|
||||
journal_id = data_obj.get_object(cr, uid, 'hr_timesheet', 'analytic_journal').id
|
||||
except ValueError:
|
||||
journal_id = False
|
||||
line_ids = self.pool.get('hr.expense.line').search(cr,uid,[('analytic_account','=',account.id)])
|
||||
id2 = data_obj._get_id(cr, uid, 'hr_expense', 'view_expenses_form')
|
||||
id3 = data_obj._get_id(cr, uid, 'hr_expense', 'view_expenses_tree')
|
||||
if id2:
|
||||
id2 = data_obj.browse(cr, uid, id2, context=context).res_id
|
||||
if id3:
|
||||
id3 = data_obj.browse(cr, uid, id3, context=context).res_id
|
||||
domain = [('line_ids','in',line_ids)]
|
||||
line_ids = self.pool.get('hr.expense.line').search(cr,uid,[('analytic_account', 'in', ids)])
|
||||
domain = [('line_ids', 'in', line_ids)]
|
||||
names = [record.name for record in self.browse(cr, uid, ids, context=context)]
|
||||
name = _('Expenses of %s') % ','.join(names)
|
||||
return {
|
||||
'type': 'ir.actions.act_window',
|
||||
'name': _('Expenses'),
|
||||
'name': name,
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,form',
|
||||
'views': [(id3,'tree'),(id2,'form')],
|
||||
'domain' : domain,
|
||||
'res_model': 'hr.expense.expense',
|
||||
'nodestroy': True,
|
||||
}
|
||||
|
||||
def hr_to_invoiced_expense(self, cr, uid, ids, context=None):
|
||||
res = self.open_hr_expense(cr,uid,ids,context)
|
||||
account = self.browse(cr, uid, ids[0], context)
|
||||
line_ids = self.pool.get('hr.expense.line').search(cr,uid,[('analytic_account','=',account.id)])
|
||||
res['domain'] = [('line_ids','in',line_ids),('state','=','invoiced')]
|
||||
return res
|
||||
def hr_to_invoice_expense(self, cr, uid, ids, context=None):
|
||||
domain = [('invoice_id','=',False),('to_invoice','!=',False), ('journal_id.type', '=', 'purchase'), ('account_id', 'in', ids)]
|
||||
names = [record.name for record in self.browse(cr, uid, ids, context=context)]
|
||||
name = _('Expenses to Invoice of %s') % ','.join(names)
|
||||
return {
|
||||
'type': 'ir.actions.act_window',
|
||||
'name': name,
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,form',
|
||||
'domain' : domain,
|
||||
'res_model': 'account.analytic.line',
|
||||
'nodestroy': True,
|
||||
}
|
||||
|
||||
account_analytic_account()
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
<field class="oe_form_inline" name="expense_to_invoice" attrs="{'invisible': [('charge_expenses','=',False)]}"/>
|
||||
</td><td>
|
||||
<button name="open_hr_expense" string="All Expenses" type="object" attrs="{'invisible': [('charge_expenses','=',False)]}"/>
|
||||
<button name="hr_to_invoiced_expense" string="Expenses to Invoice" type="object" attrs="{'invisible': [('charge_expenses','=',False)]}"/>
|
||||
<button name="hr_to_invoice_expense" string="Expenses to Invoice" type="object" attrs="{'invisible': [('charge_expenses','=',False)]}"/>
|
||||
</td>
|
||||
</tr>
|
||||
</xpath>
|
||||
|
|
|
@ -135,10 +135,10 @@
|
|||
</record>
|
||||
|
||||
<act_window
|
||||
domain="[('invoice_id','=',False),('to_invoice','<>',False)]"
|
||||
domain="[('invoice_id','=',False),('to_invoice','<>',False), ('journal_id.type', '=', 'general')]"
|
||||
context="{'search_default_account_id': [active_id], 'default_account_id': active_id,'search_default_to_invoice': 1}"
|
||||
id="act_acc_analytic_acc_2_report_acc_analytic_line_to_invoice"
|
||||
name="Lines to Invoice"
|
||||
name="Timesheet Lines to Invoice"
|
||||
res_model="account.analytic.line"
|
||||
src_model="account.analytic.account"/>
|
||||
|
||||
|
|
|
@ -288,6 +288,7 @@
|
|||
<field name="name"
|
||||
filter_domain="['|', ('name','ilike',self),('client_order_ref','ilike',self)]"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="project_id" groups="sale.group_analytic_accounting"/>
|
||||
<field name="user_id">
|
||||
<filter domain="[('user_id','=',uid)]" help="My Sale Orders" icon="terp-personal"/>
|
||||
</field>
|
||||
|
|
Loading…
Reference in New Issue