[FIX] analytic_contract_project: fixed the destination of shortcut buttons in project form view
bzr revid: qdp-launchpad@openerp.com-20120618170333-xsml2de6dd18ozwg
This commit is contained in:
parent
9e20a7f299
commit
2f6e1c9dc8
|
@ -20,13 +20,32 @@
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
from osv import fields, osv
|
from osv import fields, osv
|
||||||
|
from tools.translate import _
|
||||||
|
|
||||||
class project_project(osv.osv):
|
class project_project(osv.osv):
|
||||||
_inherit = 'project.project'
|
_inherit = 'project.project'
|
||||||
_columns = {
|
|
||||||
# 'use_timesheets': fields.boolean('Timesheets', help="Check this field if this project manages timesheets"),
|
|
||||||
}
|
|
||||||
_defaults = {
|
_defaults = {
|
||||||
'use_timesheets': True,
|
'use_timesheets': True,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def open_sale_order_lines(self,cr,uid,ids,context=None):
|
||||||
|
account_ids = [x.analytic_account_id.id for x in self.browse(cr, uid, ids, context=context)]
|
||||||
|
return self.pool.get('account.analytic.account').open_sale_order_lines(cr, uid, account_ids, context=context)
|
||||||
|
|
||||||
|
def open_timesheets_to_invoice(self,cr,uid,ids,context=None):
|
||||||
|
if context is None:
|
||||||
|
context = {}
|
||||||
|
analytic_account_id = self.browse(cr, uid, ids[0], context=context).analytic_account_id.id
|
||||||
|
context.update({'search_default_account_id': analytic_account_id, 'default_account_id': analytic_account_id, 'search_default_to_invoice': 1})
|
||||||
|
return {
|
||||||
|
'type': 'ir.actions.act_window',
|
||||||
|
'name': _('Timesheet Lines to Invoice'),
|
||||||
|
'view_type': 'form',
|
||||||
|
'view_mode': 'tree,form',
|
||||||
|
'context': context,
|
||||||
|
'domain' : [('invoice_id','=',False),('to_invoice','!=',False), ('journal_id.type', '=', 'general')],
|
||||||
|
'res_model': 'account.analytic.line',
|
||||||
|
'nodestroy': True,
|
||||||
|
}
|
||||||
project_project()
|
project_project()
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<openerp>
|
<openerp>
|
||||||
<data>
|
<data>
|
||||||
|
|
||||||
<record id="project_account_analytic_account_form" model="ir.ui.view">
|
<record id="project_account_analytic_account_form" model="ir.ui.view">
|
||||||
<field name="name">project.project.form.inherit</field>
|
<field name="name">project.project.form.inherit</field>
|
||||||
<field name="model">project.project</field>
|
<field name="model">project.project</field>
|
||||||
|
@ -52,8 +53,8 @@
|
||||||
</td><td>
|
</td><td>
|
||||||
<field class="oe_form_inline" name="ca_to_invoice" attrs="{'invisible': [('fix_price_invoices','=',False)]}"/>
|
<field class="oe_form_inline" name="ca_to_invoice" attrs="{'invisible': [('fix_price_invoices','=',False)]}"/>
|
||||||
</td><td>
|
</td><td>
|
||||||
<button name="%(account_analytic_analysis.action_sales_order)d" string="All Sales" type="action" context="{'default_partner_id': [partner_id], 'search_default_partner_id': [partner_id]}" attrs="{'invisible': [('fix_price_invoices','=',False)]}"/>
|
<button name="%(account_analytic_analysis.action_sales_order)d" string="All Sales" type="action" context="{'default_partner_id': [partner_id], 'search_default_partner_id': [partner_id], 'default_project_id': analytic_account_id, 'search_default_project_id': analytic_account_id}" attrs="{'invisible': [('fix_price_invoices','=',False)]}"/>
|
||||||
<button name="%(sale.action_order_line_tree2)d" string="Lines To Invoice" type="action" context="{'default_project_id': active_id,'search_default_project_id': active_id}" attrs="{'invisible': [('fix_price_invoices','=',False)]}"/></td>
|
<button name="open_sale_order_lines" string="Lines To Invoice" type="object" context="{'default_partner_id': [partner_id],'default_project_id': analytic_account_id,'search_default_uninvoiced': 1,'search_default_project_id': analytic_account_id,'search_default_partner_id': [partner_id]}" attrs="{'invisible': [('fix_price_invoices','=',False)]}"/></td>
|
||||||
</tr><tr nameattrs="{'invisible':[('use_timesheets','=',False)]}">
|
</tr><tr nameattrs="{'invisible':[('use_timesheets','=',False)]}">
|
||||||
<td>
|
<td>
|
||||||
<label for="invoice_on_timesheets"/>
|
<label for="invoice_on_timesheets"/>
|
||||||
|
@ -68,10 +69,10 @@
|
||||||
</td><td>
|
</td><td>
|
||||||
<field class="oe_form_inline" name="hours_qtt_non_invoiced" attrs="{'invisible': [('invoice_on_timesheets','=',False)]}"/>
|
<field class="oe_form_inline" name="hours_qtt_non_invoiced" attrs="{'invisible': [('invoice_on_timesheets','=',False)]}"/>
|
||||||
</td><td>
|
</td><td>
|
||||||
<button name="%(hr_timesheet.act_hr_timesheet_line_evry1_all_form)d" string="All Timesheets" type="action" attrs="{'invisible': [('invoice_on_timesheets','=',False)]}" context="{'default_account_id': active_id,'search_default_account_id': active_id}"/>
|
<button name="%(hr_timesheet.act_hr_timesheet_line_evry1_all_form)d" string="All Timesheets" type="action" attrs="{'invisible': [('invoice_on_timesheets','=',False)]}" context="{'default_account_id': analytic_account_id,'search_default_account_id': analytic_account_id}"/>
|
||||||
<button name="%(hr_timesheet_invoice.act_acc_analytic_acc_2_report_acc_analytic_line_to_invoice)d" string="Timesheets to Invoice" type="action" attrs="{'invisible': [('invoice_on_timesheets','=',False)]}"/>
|
<button name="open_timesheets_to_invoice" string="Timesheets to Invoice" type="object" attrs="{'invisible': [('invoice_on_timesheets','=',False)]}"/>
|
||||||
</td>
|
</td>
|
||||||
</tr><tr>
|
</tr><tr name="total">
|
||||||
<th>
|
<th>
|
||||||
<label string="Total"/>
|
<label string="Total"/>
|
||||||
</th><td>
|
</th><td>
|
||||||
|
|
Loading…
Reference in New Issue