bzr revid: stephane@tinyerp.com-20081124105922-ae71byvr4psplbm3
This commit is contained in:
Stephane Wirtel
2008-11-24 11:59:22 +01:00
19 changed files with 112 additions and 117 deletions
+11 -3
View File
@@ -219,6 +219,7 @@ def log_fct( db, uid, passwd, object, method, fct_src , *args ):
lines.append(line)
create_log_line(cr,uid,id,model_object,lines)
cr.commit()
cr.close()
return res_id
if method in ('write'):
@@ -247,6 +248,7 @@ def log_fct( db, uid, passwd, object, method, fct_src , *args ):
lines.append(line)
cr.commit()
create_log_line(cr,uid,id,model_object,lines)
cr.close()
return res
if method in ('read'):
@@ -273,6 +275,7 @@ def log_fct( db, uid, passwd, object, method, fct_src , *args ):
lines.append(line)
cr.commit()
create_log_line(cr,uid,id,model_object,lines)
cr.close()
return res
if method in ('unlink'):
@@ -296,12 +299,15 @@ def log_fct( db, uid, passwd, object, method, fct_src , *args ):
cr.commit()
create_log_line(cr,uid,id,model_object,lines)
res =fct_src( db, uid, passwd, object, method, *args)
cr.close()
return res
cr.close()
def tmp_fct(fct_src):
def execute( db, uid, passwd, object, method, *args):
pool = pooler.get_pool(db)
cr = pooler.get_db(db).cursor()
cr.autocommit(True)
obj=pool.get(object)
logged_uids = []
object_name=obj._name
@@ -330,12 +336,14 @@ def tmp_fct(fct_src):
if getattr(thisrule, 'log_'+field):
return log_fct(db, uid, passwd, object, method, fct_src , *args)
return fct_src( db, uid, passwd, object, method, *args)
cr.commit()
return my_fct( db, uid, passwd, object, method, *args)
res = my_fct( db, uid, passwd, object, method, *args)
cr.close()
return res
return execute
obj = netsvc._service['object']
obj.execute = tmp_fct(obj.execute)
obj.exportMethod(obj.execute)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -101,6 +101,9 @@ def _upload(self, cr, uid, datas, context):
], [('module', res['module_filename'],
res['module_file'])
])
print '-'*50
print result
print '-'*50
if result[0] == "1":
raise wizard.except_wizard('Error', 'Login failed!')
elif result[0] == "0":
@@ -126,13 +129,18 @@ def _upload(self, cr, uid, datas, context):
'auto_login': datas['form']['login'],
'auto_password': datas['form']['password']
}
print updata
a = urlopen('http://www.openerp.com/mtree_interface.php?module=%s' % (mod.name,))
aa = a.read()
print '='*40
print aa
if aa[0]<>'0':
updata['link_id']=aa.split('\n')[0]
updata['cat_id']=aa.split('\n')[1]
updata['option'] = 'mtree'
result = post_multipart('www.openerp.com', '/index.php', updata.items(), [])
print '.'*50
print result
return {'update': '\n'.join(log[0]), 'already': '\n'.join(log[1]),
'error': '\n'.join(log[2])}
+11 -12
View File
@@ -33,6 +33,17 @@ from content_index import content_index
import netsvc
import StringIO
import random
import string
def random_name():
random.seed()
d = [random.choice(string.letters) for x in xrange(10) ]
name = "".join(d)
return name
# Unsupported WebDAV Commands:
# label
# search
@@ -462,18 +473,6 @@ class ir_action_report_xml(osv.osv):
ir_action_report_xml()
import random
import string
def random_name():
random.seed()
d = [random.choice(string.letters) for x in xrange(10) ]
name = "".join(d)
return name
def create_directory(path):
dir_name = random_name()
path = os.path.join(path,dir_name)
+1 -1
View File
@@ -1,7 +1,7 @@
<openerp>
<data>
<menuitem name="Document Management" icon="terp-stock" id="menu_document"/>
<menuitem name="Configuration" id="menu_document_configuration" parent="menu_document"/>
<menuitem name="Document Configuration" id="menu_document_configuration" parent="menu_document"/>
<record model="ir.ui.view" id="view_document_directory_form">
<field name="name">document.directory</field>
+1 -1
View File
@@ -18,7 +18,7 @@
<field name="extension">.ics</field>
<field name="include_name" eval="False"/>
<field name="ics_object_id" ref="crm.model_crm_case"/>
<field name="ics_domain" eval="'[(\'section_id\',\'=\','+ref('section_meeting')+')]'"/>
<field name="ics_domain" eval="'[(\'section_id\',\'=\','+str(ref('section_meeting'))+')]'"/>
</record>
<record model="document.directory.ics.fields" id="dir_field1">
-25
View File
@@ -115,30 +115,5 @@
<field name="mail_confirm">Thanks for registrering. The conference will begin at 2 PM and will be given by Mister Pinckaers.</field>
</record>
<!-- Demo data for Registration -->
<record id="event_registration_0" model="event.registration">
<field name="name">Registration for "Conference on Environment"</field>
<field name="partner_id" ref="base.res_partner_asus"/>
<field name="event_id" ref="event_2"/>
<field name="unit_price">15.50</field>
<field name="invoice_label">Ticket for Conference</field>
</record>
<record id="event_registration_1" model="event.registration">
<field name="name">Registration for "Opera of Verdi"</field>
<field name="partner_id" ref="base.res_partner_agrolait"/>
<field name="event_id" ref="event_1"/>
<field name="invoice_label">Ticket for Opera</field>
<field name="unit_price">24.00</field>
<field name="nb_register">5</field>
</record>
<record id="event_registration_2" model="event.registration">
<field name="name">Registration for "Concert of Bon Jovi"</field>
<field name="partner_id" ref="base.res_partner_c2c"/>
<field name="event_id" ref="event_0"/>
<field name="invoice_label">Ticket for Concert</field>
<field name="unit_price">68.00</field>
<field name="nb_register">2</field>
</record>
</data>
</openerp>
+2 -2
View File
@@ -685,8 +685,8 @@ class mrp_production_workcenter_line(osv.osv):
_columns = {
'name': fields.char('Name', size=64, required=True),
'workcenter_id': fields.many2one('mrp.workcenter', 'Workcenter', required=True),
'cycle': fields.float('Nbr of cycle'),
'hour': fields.float('Nbr of hour'),
'cycle': fields.float('Nbr of cycle', digits=(16,2)),
'hour': fields.float('Nbr of hour', digits=(16,2)),
'sequence': fields.integer('Sequence', required=True),
'production_id': fields.many2one('mrp.production', 'Production Order', select=True),
}
+2 -3
View File
@@ -44,14 +44,13 @@ class mrp_production_workcenter_line(osv.osv):
_description = 'Production workcenters used'
_columns = {
'state': fields.selection([('draft','Draft'),('startworking', 'In Progress'),('pause','Pause'),('cancel','Canceled'),('done','Finished')],'Status', readonly=True),
'date_planned': fields.related('production_id', 'date_planned', type='datetime', string='Date Planned'),
'date_start': fields.datetime('Start Date'),
'date_finnished': fields.datetime('End Date'),
'delay': fields.char('Delay',size=128,help="This is delay between operation start and stop in this workcenter",readonly=True),
'delay': fields.float('Delay',size=128,help="This is delay between operation start and stop in this workcenter",readonly=True),
'product':fields.related('production_id','product_id',type='many2one',relation='product.product',string='Product'),
'qty':fields.related('production_id','product_qty',type='float',string='Qty'),
'uom':fields.related('production_id','product_uom',type='many2one',relation='product.uom',string='UOM'),
}
_defaults = {
'state': lambda *a: 'draft',
+30 -3
View File
@@ -42,6 +42,33 @@
</field>
</record>
<record id="workcenter_line_calendar" model="ir.ui.view">
<field name="name">mrp.production.workcenter.line.calendar</field>
<field name="model">mrp.production.workcenter.line</field>
<field name="type">calendar</field>
<field name="arch" type="xml">
<calendar color="product" date_stop="date_finnished" date_start="date_start" string="Operations">
<field name="workcenter_id"/>
<field name="production_id"/>
</calendar>
</field>
</record>
<record id="workcenter_line_gantt" model="ir.ui.view">
<field name="name">mrp.production.workcenter.line.gantt</field>
<field name="model">mrp.production.workcenter.line</field>
<field name="type">gantt</field>
<field name="arch" type="xml">
<gantt color="workcenter_id" date_delay="hour" date_start="date_planned" string="Operations">
<level object="product.product" link="product" domain="[]">
<field name="production_id"/>
</level>
</gantt>
</field>
</record>
<!-- Action for tree view of workcenter line -->
<record model="ir.actions.act_window" id="mrp_production_wc_action_form">
@@ -49,7 +76,7 @@
<field name="type">ir.actions.act_window</field>
<field name="res_model">mrp.production.workcenter.line</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_mode">tree,form,gantt,calendar,graph</field>
<field name="domain">[('id','=',active_id)]</field>
</record>
@@ -60,7 +87,7 @@
<field name="type">ir.actions.act_window</field>
<field name="res_model">mrp.production.workcenter.line</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,graph</field>
<field name="view_mode">tree,form,graph,calendar,gantt</field>
</record>
<!-- Action for Confirm Operations -->
@@ -70,7 +97,7 @@
<field name="type">ir.actions.act_window</field>
<field name="res_model">mrp.production.workcenter.line</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,graph</field>
<field name="view_mode">tree,form,graph,gantt,calendar</field>
<field name="domain">[('state','=','confirm')]</field>
</record>
+23 -49
View File
@@ -31,46 +31,6 @@ class project(osv.osv):
_name = "project.project"
_description = "Project"
def _calc_effective(self, cr, uid, ids, name, args, context):
ids2 = self.search(cr, uid, [('parent_id', 'child_of', ids)])
res_sum = {}
if ids2:
cr.execute('SELECT t.project_id, COALESCE(SUM(w.hours),0) \
FROM project_task t \
LEFT JOIN project_task_work w \
ON (w.task_id = t.id) \
WHERE t.project_id in (' + ','.join([str(x) for x in ids2]) + ') \
AND active \
GROUP BY project_id')
for project_id, sum in cr.fetchall():
res_sum[project_id] = sum
res={}
for id in ids:
ids3 = self.search(cr, uid, [('parent_id', 'child_of', [id])])
res.setdefault(id, 0.0)
for idx in ids3:
res[id] += res_sum.get(idx, 0.0)
return res
def _calc_planned(self, cr, uid, ids, name, args, context):
ids2 = self.search(cr, uid, [('parent_id', 'child_of', ids)])
res_sum = {}
if ids2:
cr.execute('SELECT project_id, COALESCE(SUM(total_hours),0) \
FROM project_task \
WHERE project_id IN (' + ','.join([str(x) for x in ids2]) + ') \
AND active \
GROUP BY project_id')
for project_id, sum in cr.fetchall():
res_sum[project_id] = sum
res = {}
for id in ids:
ids3 = self.search(cr, uid, [('parent_id', 'child_of', [id])])
res.setdefault(id, 0.0)
for idx in ids3:
res[id] += res_sum.get(idx, 0.0)
return res
def check_recursion(self, cursor, user, ids, parent=None):
return super(project, self).check_recursion(cursor, user, ids,
parent=parent)
@@ -83,22 +43,35 @@ class project(osv.osv):
pricelist = self.pool.get('res.partner').browse(cr, uid, part).property_product_pricelist.id
return {'value':{'contact_id': addr['contact'], 'pricelist_id': pricelist}}
def _progress_rate(self, cr, uid, ids, name, arg, context=None):
def _progress_rate(self, cr, uid, ids, names, arg, context=None):
res = {}.fromkeys(ids, 0.0)
if not ids:
return res
ids2 = self.search(cr, uid, [('parent_id','child_of',ids)])
cr.execute('''SELECT
project_id, sum(progress*total_hours), sum(total_hours)
project_id, sum(planned_hours), sum(total_hours), sum(effective_hours)
FROM
project_task
WHERE
project_id in ('''+','.join(map(str,ids))+''') AND
project_id in ('''+','.join(map(str,ids2))+''') AND
state<>'cancelled'
GROUP BY
project_id''')
for id,prog,tot in cr.fetchall():
if tot:
res[id] = prog / tot
progress = dict(map(lambda x: (x[0], (x[1],x[2],x[3])), cr.fetchall()))
for project in self.browse(cr, uid, ids, context=context):
s = [0.0,0.0,0.0]
tocompute = [project]
while tocompute:
p = tocompute.pop()
tocompute += p.child_id
for i in range(3):
s[i] += progress.get(p.id, (0.0,0.0,0.0))[i]
res[project.id] = {
'planned_hours': s[0],
'effective_hours': s[2],
'total_hours': s[1],
'progress_rate': s[1] and (100.0 * s[2] / s[1]) or 0.0
}
return res
def unlink(self, cr, uid, ids, *args, **kwargs):
@@ -117,9 +90,10 @@ class project(osv.osv):
'tasks': fields.one2many('project.task', 'project_id', "Project tasks"),
'parent_id': fields.many2one('project.project', 'Parent Project'),
'child_id': fields.one2many('project.project', 'parent_id', 'Subproject'),
'planned_hours': fields.function(_calc_planned, method=True, string='Planned hours', help="Sum of planned hours of all tasks related to this project."),
'effective_hours': fields.function(_calc_effective, method=True, string='Hours spent', help="Sum of spent hours of all tasks related to this project."),
'progress_rate': fields.function(_progress_rate, method=True, string='Progress', type='float', help="Percent of tasks closed according to the total of tasks todo."),
'planned_hours': fields.function(_progress_rate, multi="progress", method=True, string='Planned Time', help="Sum of planned hours of all tasks related to this project."),
'effective_hours': fields.function(_progress_rate, multi="progress", method=True, string='Time Spent', help="Sum of spent hours of all tasks related to this project."),
'total_hours': fields.function(_progress_rate, multi="progress", method=True, string='Total Time', help="Sum of total hours of all tasks related to this project."),
'progress_rate': fields.function(_progress_rate, multi="progress", method=True, string='Progress', type='float', help="Percent of tasks closed according to the total of tasks todo."),
'date_start': fields.date('Starting Date'),
'date_end': fields.date('Expected End'),
'partner_id': fields.many2one('res.partner', 'Partner'),
+1
View File
@@ -84,6 +84,7 @@
<field name="manager"/>
<field name="partner_id"/>
<field name="planned_hours" widget="float_time"/>
<field name="total_hours" widget="float_time"/>
<field name="effective_hours" widget="float_time"/>
<field name="progress_rate" widget="progressbar"/>
<field name="state"/>
+1 -1
View File
@@ -63,7 +63,7 @@ class purchase_order(osv.osv):
cur=order.pricelist_id.currency_id
for line in order.order_line:
for c in self.pool.get('account.tax').compute(cr, uid, line.taxes_id, line.price_unit, line.product_qty, order.partner_address_id.id, line.product_id, order.partner_id):
val+= cur_obj.round(cr, uid, cur, c['amount'])
val+= c['amount']
res[order.id]=cur_obj.round(cr, uid, cur, val)
return res
+2 -2
View File
@@ -149,7 +149,7 @@
<para style="terp_default_9">
<font color="white"> </font>
</para>
<para style="terp_default_Bold_9">Invoice address :[[ o.partner_id.property_payment_term.name ]]</para>
<para style="terp_default_Bold_9">Invoice address :</para>
<para style="terp_default_9">[[ o.partner_invoice_id.street ]][[ o.partner_invoice_id.street2 and (', %s' % o.partner_invoice_id.street2 or '') ]]</para>
<para style="terp_default_9">[[ o.partner_invoice_id.zip or '' ]][[ o.partner_invoice_id.city or '' ]][[ o.partner_invoice_id.country_id and (', %s' % (o.partner_invoice_id.country_id and o.partner_invoice_id.country_id.name or '')) ]]</para>
</td>
@@ -213,7 +213,7 @@
<para style="terp_default_Centre_8">[[ o.user_id.name ]]</para>
</td>
<td>
<para style="terp_default_Centre_8">[[ o.partner_id and o.partner_id.property_payment_term and o.partner_id.property_payment_term['name'] or '' ]]</para>
<para style="terp_default_Centre_8">[[ o.payment_term.name ]]</para>
</td>
</tr>
</blockTable>
+1 -1
View File
@@ -79,7 +79,7 @@ class sale_order(osv.osv):
cur=order.pricelist_id.currency_id
for line in order.order_line:
for c in self.pool.get('account.tax').compute(cr, uid, line.tax_id, line.price_unit * (1-(line.discount or 0.0)/100.0), line.product_uom_qty, order.partner_invoice_id.id, line.product_id, order.partner_id):
val+= cur_obj.round(cr, uid, cur, c['amount'])
val+= c['amount']
res[order.id]=cur_obj.round(cr, uid, cur, val)
return res
+1 -1
View File
@@ -348,7 +348,7 @@
<field name="arch" type="xml">
<graph string="Sales order lines">
<field name="product_id"/>
<field name="price_unit" operator="+"/>
<field name="price_subtotal" operator="+"/>
</graph>
</field>
</record>
+8 -8
View File
@@ -271,26 +271,26 @@
<wizard
id="action_lot2"
model="stock.production.lot"
name="stock.traceability.lot.amont"
string="Downstream traceability"/>
name="stock.traceability.lot.upstream"
string="Upstream traceability"/>
<wizard
id="action_lot4"
model="stock.production.lot"
name="stock.traceability.lot.aval"
string="Upstream traceability"/>
name="stock.traceability.lot.downstream"
string="Downstream traceability"/>
<wizard
id="action4"
model="stock.tracking"
name="stock.traceability.amont"
string="Downstream traceability"/>
name="stock.traceability.upstream"
string="Upstream traceability"/>
<wizard
id="action2"
model="stock.tracking"
name="stock.traceability.aval"
string="Upstream traceability"/>
name="stock.traceability.downstream"
string="Downstream traceability"/>
<record id="action3" model="ir.actions.act_window">
<field name="name">Downstream traceability</field>
+4 -4
View File
@@ -52,7 +52,7 @@ class wiz_journal(wizard.interface):
'result': {'type': 'action', 'action': action_traceability(), 'state':'end'}
}
}
wiz_journal('stock.traceability.aval')
wiz_journal('stock.traceability.downstream')
class wiz_journal2(wizard.interface):
states = {
@@ -61,7 +61,7 @@ class wiz_journal2(wizard.interface):
'result': {'type': 'action', 'action': action_traceability('move_history_ids2'), 'state':'end'}
}
}
wiz_journal2('stock.traceability.amont')
wiz_journal2('stock.traceability.upstream')
class wiz_journal3(wizard.interface):
states = {
@@ -70,7 +70,7 @@ class wiz_journal3(wizard.interface):
'result': {'type': 'action', 'action': action_traceability(field='prodlot_id'), 'state':'end'}
}
}
wiz_journal3('stock.traceability.lot.amont')
wiz_journal3('stock.traceability.lot.upstream')
class wiz_journal4(wizard.interface):
states = {
@@ -79,7 +79,7 @@ class wiz_journal4(wizard.interface):
'result': {'type': 'action', 'action': action_traceability('move_history_ids2', 'prodlot_id'), 'state':'end'}
}
}
wiz_journal4('stock.traceability.lot.aval')
wiz_journal4('stock.traceability.lot.downstream')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+4
View File
@@ -0,0 +1,4 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
"wiki_wiki","wiki.wiki","model_wiki_wiki","base.group_user",1,1,1,1
"wiki_groups","wiki.groups","model_wiki_groups","base.group_user",1,1,1,1
"wiki_wiki_history","wiki.wiki.history","model_wiki_wiki_history","base.group_user",1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 wiki_wiki wiki.wiki model_wiki_wiki base.group_user 1 1 1 1
3 wiki_groups wiki.groups model_wiki_groups base.group_user 1 1 1 1
4 wiki_wiki_history wiki.wiki.history model_wiki_wiki_history base.group_user 1 1 1 1
+1 -1
View File
@@ -2,7 +2,7 @@
<openerp>
<data>
<menuitem name="Document Management" icon="terp-stock" id="menu_document2"/>
<menuitem name="Configuration" id="menu_document_configuration" parent="menu_document2"/>
<menuitem name="Wiki Configuration" id="menu_document_configuration" parent="menu_document2"/>
<menuitem parent="menu_document2" name="Wiki" id="menu_document"/>
<wizard