project_improve
bzr revid: fp@tinyerp.com-20081027111326-z1cxmsqp8u17s84e
This commit is contained in:
parent
f23aba092c
commit
89b1504f3a
|
@ -665,6 +665,15 @@ class account_move(osv.osv):
|
||||||
return periods[0]
|
return periods[0]
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def _amount_compute(self, cr, uid, ids, name, args, context, where =''):
|
||||||
|
if not ids: return {}
|
||||||
|
cr.execute('select move_id,sum(debit) from account_move_line where move_id in ('+','.join(map(str,ids))+') group by move_id')
|
||||||
|
result = dict(cr.fetchall())
|
||||||
|
for id in ids:
|
||||||
|
result.setdefault(id, 0.0)
|
||||||
|
return result
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
'name': fields.char('Entry Name', size=64, required=True),
|
'name': fields.char('Entry Name', size=64, required=True),
|
||||||
'ref': fields.char('Ref', size=64),
|
'ref': fields.char('Ref', size=64),
|
||||||
|
@ -673,6 +682,8 @@ class account_move(osv.osv):
|
||||||
'state': fields.selection([('draft','Draft'), ('posted','Posted')], 'Status', required=True, readonly=True),
|
'state': fields.selection([('draft','Draft'), ('posted','Posted')], 'Status', required=True, readonly=True),
|
||||||
'line_id': fields.one2many('account.move.line', 'move_id', 'Entries', states={'posted':[('readonly',True)]}),
|
'line_id': fields.one2many('account.move.line', 'move_id', 'Entries', states={'posted':[('readonly',True)]}),
|
||||||
'to_check': fields.boolean('To Be Verified'),
|
'to_check': fields.boolean('To Be Verified'),
|
||||||
|
'partner_id': fields.related('line_id', 'partner_id', type="many2one", relation="res.partner", string="Partner", store=True),
|
||||||
|
'amount': fields.function(_amount_compute, method=True, string='Amount', digits=(16,2), store=True),
|
||||||
}
|
}
|
||||||
_defaults = {
|
_defaults = {
|
||||||
'state': lambda *a: 'draft',
|
'state': lambda *a: 'draft',
|
||||||
|
|
|
@ -465,6 +465,8 @@
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
<field name="period_id"/>
|
<field name="period_id"/>
|
||||||
<field name="journal_id"/>
|
<field name="journal_id"/>
|
||||||
|
<field name="partner_id"/>
|
||||||
|
<field name="amount"/>
|
||||||
<field name="state"/>
|
<field name="state"/>
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
|
@ -807,11 +809,15 @@
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<form string="Account Entry">
|
<form string="Account Entry">
|
||||||
<separator colspan="4" string="General Information"/>
|
<separator colspan="4" string="General Information"/>
|
||||||
|
<group colspan="4" col="6">
|
||||||
<field name="name" select="1"/>
|
<field name="name" select="1"/>
|
||||||
<field name="ref" select="1"/>
|
|
||||||
<field name="period_id" select="2"/>
|
<field name="period_id" select="2"/>
|
||||||
<field name="journal_id" select="1"/>
|
<field name="journal_id" select="1"/>
|
||||||
<field name="to_check" select="2"/>
|
<field name="partner_id" select="2"/>
|
||||||
|
<field name="amount" select="2"/>
|
||||||
|
<field name="ref" select="1" groups="base.group_extended"/>
|
||||||
|
<field name="to_check" select="2" groups="base.group_extended"/>
|
||||||
|
</group>
|
||||||
|
|
||||||
<separator colspan="4" string="Entry Lines"/>
|
<separator colspan="4" string="Entry Lines"/>
|
||||||
<field colspan="4" name="line_id" nolabel="1" widget="one2many_list" default_get="{'lines':line_id ,'journal':journal_id }">
|
<field colspan="4" name="line_id" nolabel="1" widget="one2many_list" default_get="{'lines':line_id ,'journal':journal_id }">
|
||||||
|
|
|
@ -176,8 +176,13 @@ class mrp_bom(osv.osv):
|
||||||
'name': fields.char('Name', size=64, required=True),
|
'name': fields.char('Name', size=64, required=True),
|
||||||
'code': fields.char('Code', size=16),
|
'code': fields.char('Code', size=16),
|
||||||
'active': fields.boolean('Active'),
|
'active': fields.boolean('Active'),
|
||||||
'type': fields.selection([('normal','Normal BoM'),('phantom','Sets / Phantom')], 'BoM Type', required=True, help="Use a phantom bill of material in lines that have a sub-bom and that have to be automatically computed in one line, without having two production orders."),
|
'type': fields.selection([('normal','Normal BoM'),('phantom','Sets / Phantom')], 'BoM Type', required=True, help=
|
||||||
|
"Use a phantom bill of material in raw materials lines that have to be " \
|
||||||
|
"automatically computed in on eproduction order and not one per level." \
|
||||||
|
"If you put \"Phantom/Set\" at the root level of a bill of material " \
|
||||||
|
"it is considered as a set or pack: the products are replaced by the components " \
|
||||||
|
"between the sale order to the picking without going through the production order." \
|
||||||
|
"The normal BoM will generate one production order per BoM level."),
|
||||||
'method': fields.function(_compute_type, string='Method', method=True, type='selection', selection=[('',''),('stock','On Stock'),('order','On Order'),('set','Set / Pack')]),
|
'method': fields.function(_compute_type, string='Method', method=True, type='selection', selection=[('',''),('stock','On Stock'),('order','On Order'),('set','Set / Pack')]),
|
||||||
|
|
||||||
'date_start': fields.date('Valid From', help="Validity of this BoM or component. Keep empty if it's always valid."),
|
'date_start': fields.date('Valid From', help="Validity of this BoM or component. Keep empty if it's always valid."),
|
||||||
|
|
|
@ -132,7 +132,7 @@ class project(osv.osv):
|
||||||
'warn_footer': fields.text('Mail footer'),
|
'warn_footer': fields.text('Mail footer'),
|
||||||
'notes': fields.text('Notes'),
|
'notes': fields.text('Notes'),
|
||||||
'timesheet_id': fields.many2one('hr.timesheet.group', 'Working Time'),
|
'timesheet_id': fields.many2one('hr.timesheet.group', 'Working Time'),
|
||||||
'state': fields.selection([('template', 'Template'), ('open', 'Open'), ('pending', 'Pending'), ('cancelled', 'Cancelled'), ('done', 'Done')], 'State', required=True),
|
'state': fields.selection([('template', 'Template'), ('open', 'Open'), ('pending', 'Pending'), ('cancelled', 'Cancelled'), ('done', 'Done')], 'State', required=True, readonly=True),
|
||||||
}
|
}
|
||||||
|
|
||||||
_defaults = {
|
_defaults = {
|
||||||
|
@ -153,6 +153,22 @@ class project(osv.osv):
|
||||||
res = self.setActive(cr, uid, ids, value=False, context=context)
|
res = self.setActive(cr, uid, ids, value=False, context=context)
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
def set_done(self, cr, uid, ids, context={}):
|
||||||
|
self.write(cr, uid, ids, {'state':'done'}, context=context)
|
||||||
|
return True
|
||||||
|
|
||||||
|
def set_cancel(self, cr, uid, ids, context={}):
|
||||||
|
self.write(cr, uid, ids, {'state':'cancelled'}, context=context)
|
||||||
|
return True
|
||||||
|
|
||||||
|
def set_pending(self, cr, uid, ids, context={}):
|
||||||
|
self.write(cr, uid, ids, {'state':'pending'}, context=context)
|
||||||
|
return True
|
||||||
|
|
||||||
|
def set_open(self, cr, uid, ids, context={}):
|
||||||
|
self.write(cr, uid, ids, {'state':'open'}, context=context)
|
||||||
|
return True
|
||||||
|
|
||||||
def reset_project(self, cr, uid, ids, context={}):
|
def reset_project(self, cr, uid, ids, context={}):
|
||||||
res = self.setActive(cr, uid, ids,value=True, context=context)
|
res = self.setActive(cr, uid, ids,value=True, context=context)
|
||||||
return res
|
return res
|
||||||
|
@ -176,7 +192,11 @@ class project(osv.osv):
|
||||||
project_ids = [x[0] for x in res]
|
project_ids = [x[0] for x in res]
|
||||||
for child in project_ids:
|
for child in project_ids:
|
||||||
self.duplicate_template(cr, uid, [child],context={'parent_id':new_id})
|
self.duplicate_template(cr, uid, [child],context={'parent_id':new_id})
|
||||||
return True
|
|
||||||
|
# TODO : Improve this to open the new project (using a wizard)
|
||||||
|
|
||||||
|
cr.commit()
|
||||||
|
raise osv.except_osv(_('Operation Done'), _('A new project has been created !\nWe suggest you to close this one and work on this new project.'))
|
||||||
|
|
||||||
# set active value for a project, its sub projects and its tasks
|
# set active value for a project, its sub projects and its tasks
|
||||||
def setActive(self, cr, uid, ids, value=True, context={}):
|
def setActive(self, cr, uid, ids, value=True, context={}):
|
||||||
|
|
|
@ -30,11 +30,17 @@
|
||||||
<newline/>
|
<newline/>
|
||||||
<separator colspan="4" string="Project's members"/>
|
<separator colspan="4" string="Project's members"/>
|
||||||
<field colspan="4" name="members" nolabel="1"/>
|
<field colspan="4" name="members" nolabel="1"/>
|
||||||
<group col="6" colspan="8">
|
<group col="9" colspan="8">
|
||||||
<field name="state"/>
|
<field name="state"/>
|
||||||
<button name="set_template" string="Set as Template" type="object" states="open"/>
|
<button name="set_template" string="Set as Template" type="object" states="open"/>
|
||||||
|
<button name="set_open" string="Reopen Project" type="object" states="pending,cancelled,done"/>
|
||||||
|
<button name="set_pending" string="Set as Pending" type="object" states="open"/>
|
||||||
|
<button name="set_cancel" string="Set as Cancel" type="object" states="open,pending"/>
|
||||||
|
<button name="set_done" string="Set as Done" type="object" states="open,pending"/>
|
||||||
<button name="reset_project" string="Reset as Project" type="object" states="template"/>
|
<button name="reset_project" string="Reset as Project" type="object" states="template"/>
|
||||||
<button name="duplicate_template" string="Duplicate Template" type="object" states="template"/>
|
<button name="duplicate_template" string="New Project Based on Template"
|
||||||
|
type="object"
|
||||||
|
states="template"/>
|
||||||
</group>
|
</group>
|
||||||
</page>
|
</page>
|
||||||
<page groups="base.group_extended" string="Partner Info">
|
<page groups="base.group_extended" string="Partner Info">
|
||||||
|
@ -48,6 +54,7 @@
|
||||||
<field name="warn_header" nolabel="1" colspan="2"/>
|
<field name="warn_header" nolabel="1" colspan="2"/>
|
||||||
<field name="warn_footer" nolabel="1" colspan="2"/>
|
<field name="warn_footer" nolabel="1" colspan="2"/>
|
||||||
<group col="3" colspan="4">
|
<group col="3" colspan="4">
|
||||||
|
<separator string="Automatic variables you can use, use exactly the same form" colspan="4"/>
|
||||||
<label string="Task: %%(name)s"/>
|
<label string="Task: %%(name)s"/>
|
||||||
<label string="User: %%(user_id)s"/>
|
<label string="User: %%(user_id)s"/>
|
||||||
<label string="ID: %%(task_id)s"/>
|
<label string="ID: %%(task_id)s"/>
|
||||||
|
@ -472,6 +479,15 @@
|
||||||
|
|
||||||
<act_window domain="[('manager', '=', active_id)]" id="act_res_users_2_project_project" name="User's projects" res_model="project.project" src_model="res.users" view_mode="tree,form" view_type="form"/>
|
<act_window domain="[('manager', '=', active_id)]" id="act_res_users_2_project_project" name="User's projects" res_model="project.project" src_model="res.users" view_mode="tree,form" view_type="form"/>
|
||||||
|
|
||||||
|
<act_window
|
||||||
|
domain="[('project_id', '=', active_id)]"
|
||||||
|
id="act_project_project_2_project_task_new"
|
||||||
|
name="Create a Task"
|
||||||
|
res_model="project.task"
|
||||||
|
src_model="project.project"
|
||||||
|
view_mode="form,tree,calendar,graph"
|
||||||
|
view_type="form"/>
|
||||||
|
|
||||||
<act_window
|
<act_window
|
||||||
domain="[('project_id', '=', active_id)]"
|
domain="[('project_id', '=', active_id)]"
|
||||||
id="act_project_project_2_project_task_all"
|
id="act_project_project_2_project_task_all"
|
||||||
|
@ -490,8 +506,6 @@
|
||||||
view_mode="tree,form,calendar,graph"
|
view_mode="tree,form,calendar,graph"
|
||||||
view_type="form"/>
|
view_type="form"/>
|
||||||
|
|
||||||
<act_window id="act_project_project_2_project_task_all" name="All tasks" res_model="project.task" src_model="project.project" view_mode="tree,form" view_type="form"/>
|
|
||||||
|
|
||||||
<record id="task_company" model="ir.ui.view">
|
<record id="task_company" model="ir.ui.view">
|
||||||
<field name="name">res.company.task.config</field>
|
<field name="name">res.company.task.config</field>
|
||||||
<field name="model">res.company</field>
|
<field name="model">res.company</field>
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
import wizard
|
import wizard
|
||||||
from tools import email_send as email
|
from tools import email_send as email
|
||||||
import pooler
|
import pooler
|
||||||
|
from osv import osv
|
||||||
|
|
||||||
mail_form = """<?xml version="1.0" ?>
|
mail_form = """<?xml version="1.0" ?>
|
||||||
<form string="Send mail to customer">
|
<form string="Send mail to customer">
|
||||||
|
|
Loading…
Reference in New Issue