[MERGE]:lp:~openerp-dev/openobject-addons/trunk-contract-apa-add-boolean-sgo
bzr revid: apa@tinyerp.com-20120528131201-9wslnip2gc0ix0mb
This commit is contained in:
commit
075b2839d5
|
@ -7,7 +7,7 @@
|
|||
|
||||
Remove information on Account data => because they move on analysis sheet
|
||||
create a page with invoicing informations
|
||||
-->
|
||||
|
||||
<record id="account_analytic_account_invoice_stat_form" model="ir.ui.view">
|
||||
<field name="name">account.analytic.account.invoice.stat.form.inherit</field>
|
||||
<field name="model">account.analytic.account</field>
|
||||
|
@ -27,7 +27,7 @@
|
|||
icon="gtk-go-forward"/>
|
||||
</group>
|
||||
</field>
|
||||
</record>
|
||||
</record> -->
|
||||
|
||||
<record id="hr_timesheet.account_analytic_account_form_form" model="ir.ui.view">
|
||||
<field name="name">account.analytic.account.invoice.form.inherit</field>
|
||||
|
@ -39,7 +39,18 @@
|
|||
<xpath expr='//field[@name="parent_id"]' position='after'>
|
||||
<field name="template_id" on_change="on_change_template(template_id)" domain="[('type','=','template')]" attrs="{'invisible': [('type','in',['view', 'normal','template'])]}" context="{'default_type' : 'template'}"/>
|
||||
</xpath>
|
||||
<notebook position="inside">
|
||||
<xpath expr='//page[@name="contract_page"]' position='inside'>
|
||||
<group colspan="4" class="oe_form_group_label_border">
|
||||
<field name="pricelist_id" />
|
||||
<field name="to_invoice" widget="selection" />
|
||||
</group>
|
||||
</xpath>
|
||||
<xpath expr='//group[@name="contract"]' position="after">
|
||||
<group col="6" colspan="3" class="oe_form_group_label_border">
|
||||
<field name="quantity_max"/><field name="company_uom_id" nolabel="1" readonly="True"/> <label string="/"/> <label string="Remaining"/> <field name="remaining_hours" nolabel="1"/>
|
||||
</group>
|
||||
</xpath>
|
||||
<!-- <notebook position="inside">
|
||||
<page string="Invoice Analysis">
|
||||
<separator colspan="4" string="Work Done Stats"/>
|
||||
|
||||
|
@ -80,7 +91,7 @@
|
|||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
</notebook>
|
||||
</notebook> -->
|
||||
|
||||
</field>
|
||||
</record>
|
||||
|
|
|
@ -73,9 +73,11 @@ class account_analytic_account(osv.osv):
|
|||
help="Fill this field if you plan to automatically generate invoices based " \
|
||||
"on the costs in this analytic account: timesheets, expenses, ..." \
|
||||
"You can configure an automatic invoice rate on analytic accounts."),
|
||||
'use_timesheets': fields.boolean('Timesheets:', help="Check this field if this project manages timesheets"),
|
||||
}
|
||||
_defaults = {
|
||||
'pricelist_id': lambda self, cr, uid, ctx: ctx.get('pricelist_id', False),
|
||||
'use_timesheets' : True,
|
||||
}
|
||||
def on_change_partner_id(self, cr, uid, ids,partner_id, context={}):
|
||||
res = super(account_analytic_account,self).on_change_partner_id(cr, uid, ids,partner_id, context=context)
|
||||
|
|
|
@ -7,7 +7,16 @@
|
|||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="analytic.view_account_analytic_account_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<group name="contract" position="after">
|
||||
<field name="partner_id" position="replace">
|
||||
<field name="partner_id" string="Customer" on_change="on_change_partner_id(partner_id, context)" required="True"/>
|
||||
</field>
|
||||
<xpath expr='//group[@name="contract"]' position='after'>
|
||||
<group colspan="2" col="2" name="project" class="oe_form_group_label_border">
|
||||
<separator colspan="2" string="Project" name="project_sep"/>
|
||||
<field name="use_timesheets" />
|
||||
</group>
|
||||
</xpath>
|
||||
<!-- <group name="contract" position="after">
|
||||
<group colspan="2" col="2" name="invoice_data">
|
||||
<separator colspan="2" string="Invoicing Data"/>
|
||||
<field name="to_invoice" widget="selection"/>
|
||||
|
@ -18,7 +27,7 @@
|
|||
<separator colspan="4" string="Invoicing Statistics"/>
|
||||
<field name="amount_invoiced"/>
|
||||
</group>
|
||||
</group>
|
||||
</group> -->
|
||||
<xpath expr="/form/sheet" position='before'>
|
||||
<div class="oe_form_topbar">
|
||||
<button name="set_pending" string="Pending" type="object" states="open"/>
|
||||
|
@ -55,7 +64,7 @@
|
|||
<field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="account_id" position="replace">
|
||||
<field domain="[('type','=','normal'),('state', '<>', 'close')]" name="account_id" on_change="on_change_account_id(account_id)" select="1"/>
|
||||
<field domain="[('type','=','normal'),('state', '<>', 'close')]" name="account_id" on_change="on_change_account_id(account_id)" select="1" context="{'search_default_use_timesheets': 1, 'default_use_timesheets': 1}"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
@ -80,7 +89,7 @@
|
|||
<field name="arch" type="xml">
|
||||
|
||||
<field name="account_id" position="replace">
|
||||
<field domain="[('type','=','normal'),('state', '<>', 'close')]" name="account_id" on_change="on_change_account_id(account_id)"/>
|
||||
<field domain="[('type','=','normal'),('state', '<>', 'close')]" name="account_id" on_change="on_change_account_id(account_id)" context="{'search_default_use_timesheets': 1, 'default_use_timesheets': 1}"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
@ -106,7 +115,8 @@
|
|||
<field name="type">tree</field>
|
||||
<field name="inherit_id" ref="account.view_account_analytic_line_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="account_id" position="after">
|
||||
<field name="account_id" position="replace">
|
||||
<field name="account_id" context="{'search_default_use_timesheets': 1, 'default_use_timesheets': 1}"/>
|
||||
<field name="to_invoice"/>
|
||||
</field>
|
||||
</field>
|
||||
|
|
|
@ -198,10 +198,8 @@ class project(osv.osv):
|
|||
'warn_header': fields.text('Mail Header', help="Header added at the beginning of the email for the warning message sent to the customer when a task is closed.", states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}),
|
||||
'warn_footer': fields.text('Mail Footer', help="Footer added at the beginning of the email for the warning message sent to the customer when a task is closed.", states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}),
|
||||
'type_ids': fields.many2many('project.task.type', 'project_task_type_rel', 'project_id', 'type_id', 'Tasks Stages', states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}),
|
||||
'use_tasks': fields.boolean('Use Tasks', help="Check this field if this project is aimed at managing tasks"),
|
||||
'task_count': fields.function(_task_count, type='integer', string="Open Tasks"),
|
||||
'color': fields.integer('Color Index'),
|
||||
'company_uom_id': fields.related('company_id', 'project_time_mode_id', type='many2one', relation='product.uom'),
|
||||
}
|
||||
|
||||
def dummy(self, cr, uid, ids, context):
|
||||
|
@ -217,7 +215,6 @@ class project(osv.osv):
|
|||
'priority': 1,
|
||||
'sequence': 10,
|
||||
'type_ids': _get_type_common,
|
||||
'use_tasks': True,
|
||||
}
|
||||
|
||||
# TODO: Why not using a SQL contraints ?
|
||||
|
@ -1234,16 +1231,35 @@ class project_work(osv.osv):
|
|||
project_work()
|
||||
|
||||
class account_analytic_account(osv.osv):
|
||||
|
||||
_inherit = 'account.analytic.account'
|
||||
_description = 'Analytic Account'
|
||||
_columns = {
|
||||
'use_tasks': fields.boolean('Tasks Management'),
|
||||
'company_uom_id': fields.related('company_id', 'project_time_mode_id', type='many2one', relation='product.uom'),
|
||||
}
|
||||
# _defaults = {
|
||||
# 'use_tasks': True,
|
||||
# }
|
||||
|
||||
def project_create(self,cr,uid,analytic_account_id,vals,context=None):
|
||||
res = {}
|
||||
project_pool = self.pool.get('project.project')
|
||||
project_id = project_pool.name_search(cr, uid, name=vals.get('name'))
|
||||
if not project_id:
|
||||
res['name'] = vals.get('name')
|
||||
res['analytic_account_id'] = analytic_account_id
|
||||
project_pool.create(cr, uid, res, context=context)
|
||||
return True
|
||||
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
if vals.get('child_ids', False) and context.get('analytic_project_copy', False):
|
||||
vals['child_ids'] = []
|
||||
return super(account_analytic_account, self).create(cr, uid, vals, context=context)
|
||||
analytic_account_id = super(account_analytic_account, self).create(cr, uid, vals, context=context)
|
||||
if vals.get('use_tasks', False):
|
||||
self.project_create(cr, uid, analytic_account_id, vals, context)
|
||||
return analytic_account_id
|
||||
|
||||
def unlink(self, cr, uid, ids, *args, **kwargs):
|
||||
project_obj = self.pool.get('project.project')
|
||||
|
|
|
@ -600,6 +600,22 @@
|
|||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="analytic_account_inherited_form" model="ir.ui.view">
|
||||
<field name="name">account.analytic.account.form.inherit</field>
|
||||
<field name="model">account.analytic.account</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="analytic.view_account_analytic_account_form"/>
|
||||
<field eval="18" name="priority"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr='//separator[@name="project_sep"]' position='replace'>
|
||||
<separator colspan="2" string="Project" name="project_sep"/>
|
||||
</xpath>
|
||||
<xpath expr='//group[@name="project"]' position='inside'>
|
||||
<field name="use_tasks" />
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_view_task" model="ir.actions.act_window">
|
||||
<field name="name">Tasks</field>
|
||||
|
|
|
@ -512,14 +512,9 @@ class project(osv.osv):
|
|||
_columns = {
|
||||
'project_escalation_id' : fields.many2one('project.project','Project Escalation', help='If any issue is escalated from the current Project, it will be listed under the project selected here.', states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}),
|
||||
'reply_to' : fields.char('Reply-To Email Address', size=256),
|
||||
'use_issues' : fields.boolean('Use Issues', help="Check this field if this project manages issues"),
|
||||
'issue_count': fields.function(_issue_count, type='integer'),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'use_issues': True,
|
||||
}
|
||||
|
||||
def _check_escalation(self, cr, uid, ids, context=None):
|
||||
project_obj = self.browse(cr, uid, ids[0], context=context)
|
||||
if project_obj.project_escalation_id:
|
||||
|
@ -532,4 +527,26 @@ class project(osv.osv):
|
|||
]
|
||||
project()
|
||||
|
||||
class account_analytic_account(osv.osv):
|
||||
|
||||
_inherit = 'account.analytic.account'
|
||||
_description = 'Analytic Account'
|
||||
|
||||
_columns = {
|
||||
'use_issues' : fields.boolean('Issue Tracking:', help="Check this field if this project manages issues"),
|
||||
}
|
||||
# _defaults = {
|
||||
# 'use_issues': True,
|
||||
# }
|
||||
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
obj_id = super(account_analytic_account, self).create(cr, uid, vals, context=context)
|
||||
if vals.get('use_issues', False):
|
||||
self.project_create(cr, uid, obj_id, vals, context)
|
||||
return obj_id
|
||||
|
||||
account_analytic_account()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -387,5 +387,20 @@
|
|||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
<record id="analytic_account_inherited_issue_form" model="ir.ui.view">
|
||||
<field name="name">account.analytic.account.issue.form.inherit</field>
|
||||
<field name="model">account.analytic.account</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="analytic.view_account_analytic_account_form"/>
|
||||
<field eval="18" name="priority"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr='//separator[@name="project_sep"]' position='replace'>
|
||||
<separator colspan="2" string="Project" name="project_sep"/>
|
||||
</xpath>
|
||||
<group name="project" position="inside">
|
||||
<field name="use_issues"/>
|
||||
</group>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -225,13 +225,9 @@ class project(osv.osv):
|
|||
|
||||
_columns = {
|
||||
'phase_ids': fields.one2many('project.phase', 'project_id', "Project Phases"),
|
||||
'use_phases': fields.boolean('Use Phases', help="Check this field if project manages phases"),
|
||||
'phase_count': fields.function(_phase_count, type='integer', string="Open Phases"),
|
||||
}
|
||||
_defaults = {
|
||||
'use_phases': True,
|
||||
}
|
||||
|
||||
|
||||
def schedule_phases(self, cr, uid, ids, context=None):
|
||||
context = context or {}
|
||||
if type(ids) in (long, int,):
|
||||
|
@ -273,6 +269,24 @@ class project(osv.osv):
|
|||
return True
|
||||
project()
|
||||
|
||||
class account_analytic_account(osv.osv):
|
||||
_inherit = 'account.analytic.account'
|
||||
_description = 'Analytic Account'
|
||||
_columns = {
|
||||
'use_phases': fields.boolean('Phases Planing', help="Check this field if project manages phases"),
|
||||
}
|
||||
# _defaults = {
|
||||
# 'use_phases': True,
|
||||
# }
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
obj_id = super(account_analytic_account, self).create(cr, uid, vals, context=context)
|
||||
if vals.get('use_phases', False):
|
||||
self.project_create(cr, uid, obj_id, vals, context)
|
||||
return obj_id
|
||||
account_analytic_account()
|
||||
|
||||
class project_task(osv.osv):
|
||||
_inherit = "project.task"
|
||||
_columns = {
|
||||
|
|
|
@ -368,6 +368,22 @@
|
|||
src_model="project.phase"
|
||||
view_mode="tree,form"
|
||||
/>
|
||||
|
||||
<record id="analytic_account_inherited_phase_form" model="ir.ui.view">
|
||||
<field name="name">account.analytic.account.phase.form.inherit</field>
|
||||
<field name="model">account.analytic.account</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="analytic.view_account_analytic_account_form"/>
|
||||
<field eval="18" name="priority"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr='//separator[@name="project_sep"]' position='replace'>
|
||||
<separator colspan="2" string="Project" name="project_sep"/>
|
||||
</xpath>
|
||||
<group name="project" position="inside">
|
||||
<field name="use_phases"/>
|
||||
</group>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
# ------------------------------------------------------
|
||||
# Menu Items
|
||||
|
|
Loading…
Reference in New Issue