Sanjay Gohel (Open ERP) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-contract-apa-add-boolean-sgo into
lp:~openerp-dev/openobject-addons/trunk-contract-apa.
Requested reviews:
Amit Patel (OpenERP) (apa-tiny)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-contract-apa-add-boolean-sgo/+merge/107621
hello sir,
I have made following changes.
add boolean fields to account.analytic.account in related project module
(project,Project_issue and long_term)
and create project on its true value.
Thank You.
SGO
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-contract-apa-add-boolean-sgo/+merge/107621
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/trunk-contract-apa.
=== modified file 'account_analytic_analysis/account_analytic_analysis_view.xml'
--- account_analytic_analysis/account_analytic_analysis_view.xml 2012-05-28 10:54:17 +0000
+++ account_analytic_analysis/account_analytic_analysis_view.xml 2012-05-28 12:59:18 +0000
@@ -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,22 @@
<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>
+ <separator colspan="4" string="Terms and Condition"/>
+ <group colspan="4" >
+ <field colspan="4" name="description" nolabel="1"/>
+ </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 +95,7 @@
</tree>
</field>
</page>
- </notebook>
+ </notebook> -->
</field>
</record>
=== modified file 'hr_timesheet_invoice/hr_timesheet_invoice.py'
--- hr_timesheet_invoice/hr_timesheet_invoice.py 2012-05-28 11:18:30 +0000
+++ hr_timesheet_invoice/hr_timesheet_invoice.py 2012-05-28 12:59:18 +0000
@@ -73,9 +73,11 @@
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)
=== modified file 'hr_timesheet_invoice/hr_timesheet_invoice_view.xml'
--- hr_timesheet_invoice/hr_timesheet_invoice_view.xml 2012-05-28 11:18:30 +0000
+++ hr_timesheet_invoice/hr_timesheet_invoice_view.xml 2012-05-28 12:59:18 +0000
@@ -7,7 +7,20 @@
<field name="type">form</field>
<field name="inherit_id" ref="analytic.view_account_analytic_account_form"/>
<field name="arch" type="xml">
+<<<<<<< TREE
<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">
+>>>>>>> MERGE-SOURCE
<group colspan="2" col="2" name="invoice_data">
<separator colspan="2" string="Invoicing Data"/>
<field name="to_invoice" widget="selection"/>
@@ -18,7 +31,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 +68,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 +93,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 +119,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>
=== modified file 'project/project.py'
--- project/project.py 2012-05-22 16:10:55 +0000
+++ project/project.py 2012-05-28 12:59:18 +0000
@@ -198,10 +198,8 @@
'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 @@
'priority': 1,
'sequence': 10,
'type_ids': _get_type_common,
- 'use_tasks': True,
}
# TODO: Why not using a SQL contraints ?
@@ -1234,16 +1231,35 @@
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')
=== modified file 'project/project_view.xml'
--- project/project_view.xml 2012-05-24 16:07:52 +0000
+++ project/project_view.xml 2012-05-28 12:59:18 +0000
@@ -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>
=== modified file 'project_issue/project_issue.py'
--- project_issue/project_issue.py 2012-05-22 16:10:55 +0000
+++ project_issue/project_issue.py 2012-05-28 12:59:18 +0000
@@ -512,14 +512,9 @@
_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 @@
]
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:
=== modified file 'project_issue/project_issue_view.xml'
--- project_issue/project_issue_view.xml 2012-05-23 15:10:54 +0000
+++ project_issue/project_issue_view.xml 2012-05-28 12:59:18 +0000
@@ -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>
=== modified file 'project_long_term/project_long_term.py'
--- project_long_term/project_long_term.py 2012-05-22 16:10:55 +0000
+++ project_long_term/project_long_term.py 2012-05-28 12:59:18 +0000
@@ -225,13 +225,9 @@
_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 @@
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 = {
=== modified file 'project_long_term/project_long_term_view.xml'
--- project_long_term/project_long_term_view.xml 2012-05-23 15:10:54 +0000
+++ project_long_term/project_long_term_view.xml 2012-05-28 12:59:18 +0000
@@ -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
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp