From 84928ad0c1ac14a64e3e1717c1c576ce525b6c49 Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Mon, 24 Nov 2008 12:13:20 +0100 Subject: [PATCH 01/45] [REF] Remove email_send_attach [IMP] Add the attachments in the email_send function [FIX] Use the subtype for the body [FIX] Use the SSL configuration bzr revid: stephane@tinyerp.com-20081124111320-mkxvxo2y9rugg6uz --- bin/tools/misc.py | 106 +++++++++++++++------------------------------- 1 file changed, 33 insertions(+), 73 deletions(-) diff --git a/bin/tools/misc.py b/bin/tools/misc.py index fc89a4522e0..cc71dd6886f 100644 --- a/bin/tools/misc.py +++ b/bin/tools/misc.py @@ -323,19 +323,30 @@ def reverse_enumerate(l): #---------------------------------------------------------- # Emails #---------------------------------------------------------- -def email_send(email_from, email_to, subject, body, email_cc=None, email_bcc=None, on_error=False, reply_to=False, tinycrm=False, ssl=False, debug=False,subtype='plain'): +def email_send(email_from, email_to, subject, body, email_cc=None, email_bcc=None, reply_to=False, attach=None, tinycrm=False, ssl=False, debug=False,subtype='plain'): """Send an email.""" - if not email_cc: - email_cc=[] - if not email_bcc: - email_bcc=[] import smtplib from email.MIMEText import MIMEText + from email.MIMEBase import MIMEBase from email.MIMEMultipart import MIMEMultipart from email.Header import Header from email.Utils import formatdate, COMMASPACE + from email.Utils import formatdate, COMMASPACE + from email import Encoders + + if not ssl: + ssl = config.get('smtp_ssl', False) + + if not email_cc: + email_cc = [] + if not email_bcc: + email_bcc = [] + + if not attach: + msg = MIMEText(body or '',_subtype=subtype,_charset='utf-8') + else: + msg = MIMEMultipart() - msg = MIMEText(body or '',_subtype=subtype,_charset='utf-8') msg['Subject'] = Header(subject.decode('utf8'), 'utf-8') msg['From'] = email_from del msg['Reply-To'] @@ -347,8 +358,19 @@ def email_send(email_from, email_to, subject, body, email_cc=None, email_bcc=Non if email_bcc: msg['Bcc'] = COMMASPACE.join(email_bcc) msg['Date'] = formatdate(localtime=True) + if tinycrm: - msg['Message-Id'] = '<'+str(time.time())+'-tinycrm-'+str(tinycrm)+'@'+socket.gethostname()+'>' + msg['Message-Id'] = "<%s-tinycrm-%s@%s>" % (time.time(), tinycrm, socket.gethostname()) + + if attach: + msg.attach( MIMEText(body or '', _charset='utf-8', _subtype=subtype) ) + + for (fname,fcontent) in attach: + part = MIMEBase('application', "octet-stream") + part.set_payload( fcontent ) + Encoders.encode_base64(part) + part.add_header('Content-Disposition', 'attachment; filename="%s"' % (fname,)) + msg.attach(part) try: s = smtplib.SMTP() @@ -362,78 +384,16 @@ def email_send(email_from, email_to, subject, body, email_cc=None, email_bcc=Non if config['smtp_user'] or config['smtp_password']: s.login(config['smtp_user'], config['smtp_password']) - s.sendmail(email_from, flatten([email_to, email_cc, email_bcc]), msg.as_string()) - s.quit() - except Exception, e: - import logging - logging.getLogger().error(str(e)) - return True - -#---------------------------------------------------------- -# Emails -#---------------------------------------------------------- -def email_send_attach(email_from, email_to, subject, body, email_cc=None, email_bcc=None, on_error=False, reply_to=False, attach=None, tinycrm=False, ssl=False, debug=False): - """Send an email.""" - if not email_cc: - email_cc=[] - if not email_bcc: - email_bcc=[] - if not attach: - attach=[] - import smtplib - from email.MIMEText import MIMEText - from email.MIMEBase import MIMEBase - from email.MIMEMultipart import MIMEMultipart - from email.Header import Header - from email.Utils import formatdate, COMMASPACE - from email import Encoders - - msg = MIMEMultipart() - - if not ssl: - ssl = config.get('smtp_ssl', False) - - msg['Subject'] = Header(subject.decode('utf8'), 'utf-8') - msg['From'] = email_from - del msg['Reply-To'] - if reply_to: - msg['Reply-To'] = reply_to - msg['To'] = COMMASPACE.join(email_to) - if email_cc: - msg['Cc'] = COMMASPACE.join(email_cc) - if email_bcc: - msg['Bcc'] = COMMASPACE.join(email_bcc) - if tinycrm: - msg['Message-Id'] = '<'+str(time.time())+'-tinycrm-'+str(tinycrm)+'@'+socket.gethostname()+'>' - msg['Date'] = formatdate(localtime=True) - msg.attach( MIMEText(body or '', _charset='utf-8', _subtype="html")) - for (fname,fcontent) in attach: - part = MIMEBase('application', "octet-stream") - part.set_payload( fcontent ) - Encoders.encode_base64(part) - part.add_header('Content-Disposition', 'attachment; filename="%s"' % (fname,)) - msg.attach(part) - try: - s = smtplib.SMTP() - - if debug: - s.debuglevel = 5 - s.connect(config['smtp_server'], config['smtp_port']) - if ssl: - s.ehlo() - s.starttls() - s.ehlo() - - if config['smtp_user'] or config['smtp_password']: - s.login(config['smtp_user'], config['smtp_password']) - s.sendmail(email_from, flatten([email_to, email_cc, email_bcc]), msg.as_string()) + s.sendmail(email_from, + flatten([email_to, email_cc, email_bcc]), + msg.as_string() + ) s.quit() except Exception, e: import logging logging.getLogger().error(str(e)) return False - return True #---------------------------------------------------------- From 224297ad39c023e2aa46a30c92572b60130e9a64 Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Mon, 24 Nov 2008 12:19:43 +0100 Subject: [PATCH 02/45] [FIX] Remove the executable flag bzr revid: stephane@tinyerp.com-20081124111943-eb4yl14pwzx9e05g --- bin/tools/amount_to_text_en.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 bin/tools/amount_to_text_en.py diff --git a/bin/tools/amount_to_text_en.py b/bin/tools/amount_to_text_en.py old mode 100755 new mode 100644 From 67409c5dec8f468060e1910807cd8c4cc1196789 Mon Sep 17 00:00:00 2001 From: Jay Vora Date: Mon, 24 Nov 2008 18:18:39 +0530 Subject: [PATCH 03/45] Colored Fields red ,those fail in constraint validation. bzr revid: jvo@tinyerp.com-20081124124839-v4ryyp5odmm5bmqn --- bin/osv/orm.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bin/osv/orm.py b/bin/osv/orm.py index 2da4b812a98..be50d0518dd 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -300,6 +300,7 @@ class orm_template(object): _description = None _inherits = {} _table = None + _invalids=[] def _field_create(self, cr, context={}): cr.execute("SELECT id FROM ir_model_data WHERE name='%s'" % ('model_'+self._name.replace('.','_'),)) @@ -651,6 +652,9 @@ class orm_template(object): def read(self, cr, user, ids, fields=None, context=None, load='_classic_read'): raise _('The read method is not implemented on this object !') + def get_invalid_fields(self,cr,uid): + return self._invalids.__str__() + def _validate(self, cr, uid, ids, context=None): context = context or {} lng = context.get('lang', False) or 'en_US' @@ -663,6 +667,7 @@ class orm_template(object): error_msgs.append( _("Error occured while validating the field(s) %s: %s") % (','.join(fields), translated_msg) ) + self._invalids.extend(fields) if error_msgs: cr.rollback() raise except_orm('ValidateError', '\n'.join(error_msgs)) From 6fbcaf0194afe3f24b2a8ca33a2f7437e4a7189d Mon Sep 17 00:00:00 2001 From: Jay Vora Date: Mon, 24 Nov 2008 18:57:43 +0530 Subject: [PATCH 04/45] Colored Fields red ,those fail in constraint validation.Modification for Updation of records bzr revid: jvo@tinyerp.com-20081124132743-v90r8wx5o33nvfyd --- bin/osv/orm.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/osv/orm.py b/bin/osv/orm.py index be50d0518dd..b056ba9dddb 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -671,6 +671,8 @@ class orm_template(object): if error_msgs: cr.rollback() raise except_orm('ValidateError', '\n'.join(error_msgs)) + else: + self._invalids=[] def default_get(self, cr, uid, fields_list, context=None): return {} From b216e06e67d53d2d1257c056915a35fc2863529c Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Mon, 24 Nov 2008 16:42:29 +0100 Subject: [PATCH 05/45] [IMP] better get_invalid_fields function bzr revid: christophe@tinyerp.com-20081124154229-st6d2ehiyc5xip0h --- bin/osv/orm.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/osv/orm.py b/bin/osv/orm.py index b056ba9dddb..292b76a400b 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -300,7 +300,7 @@ class orm_template(object): _description = None _inherits = {} _table = None - _invalids=[] + _invalids = set() def _field_create(self, cr, context={}): cr.execute("SELECT id FROM ir_model_data WHERE name='%s'" % ('model_'+self._name.replace('.','_'),)) @@ -653,7 +653,7 @@ class orm_template(object): raise _('The read method is not implemented on this object !') def get_invalid_fields(self,cr,uid): - return self._invalids.__str__() + return list(self._invalids) def _validate(self, cr, uid, ids, context=None): context = context or {} @@ -667,12 +667,12 @@ class orm_template(object): error_msgs.append( _("Error occured while validating the field(s) %s: %s") % (','.join(fields), translated_msg) ) - self._invalids.extend(fields) + self._invalids.update(fields) if error_msgs: cr.rollback() raise except_orm('ValidateError', '\n'.join(error_msgs)) else: - self._invalids=[] + self._invalids.clear() def default_get(self, cr, uid, fields_list, context=None): return {} From 1f68c755e120294f1131cc842b23c7f08bc1d40d Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Mon, 24 Nov 2008 17:22:47 +0100 Subject: [PATCH 06/45] bugfix bzr revid: fp@tinyerp.com-20081124162247-rje8rap9dre73hxp --- bin/osv/fields.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/osv/fields.py b/bin/osv/fields.py index db01b4462b8..d2d37eec55c 100644 --- a/bin/osv/fields.py +++ b/bin/osv/fields.py @@ -160,7 +160,7 @@ class char(_column): u_symb = symb else: u_symb = unicode(symb) - return u_symb.encode('utf8')[:self.size] + return u_symb[:self.size].encode('utf8') class text(_column): From 5a3a7a9f0122b1c75a84400247c4a30302825b0d Mon Sep 17 00:00:00 2001 From: qdp Date: Mon, 24 Nov 2008 17:34:24 +0100 Subject: [PATCH 07/45] *minor bugfix: removed brackets on binary filter *added company_country in variables given to pdf bzr revid: qdp@tinyerp.com-20081124163424-42sfiztqdcid26wh --- .../account_report/wizard/wizard_print_indicators_with_pdf.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/account_report/wizard/wizard_print_indicators_with_pdf.py b/addons/account_report/wizard/wizard_print_indicators_with_pdf.py index 2371f912b62..5acf794579e 100644 --- a/addons/account_report/wizard/wizard_print_indicators_with_pdf.py +++ b/addons/account_report/wizard/wizard_print_indicators_with_pdf.py @@ -41,7 +41,7 @@ form = ''' ''' fields = { - 'file': {'string':'Select a PDF File', 'type':'binary','required':True,'filters':['*.pdf']}, + 'file': {'string':'Select a PDF File', 'type':'binary','required':True,'filters':'*.pdf'}, } @@ -82,6 +82,7 @@ class report_custom(report_int): obj_user=pool.get('res.users').browse(cr,uid,uid) self.list['printing_user']=obj_user.name self.list['company_name']=obj_user.company_id.name + self.list['company_country']=obj_user.company_id.partner_id.country self.list['company_vat']=obj_user.company_id.partner_id.vat self.list['printing_time']=time.strftime('%H:%M:%S') self.list['printing_date']=time.strftime('%D') From 36d4f14a2abc6af97aa8634f9c984804cec1a925 Mon Sep 17 00:00:00 2001 From: qdp Date: Mon, 24 Nov 2008 17:51:26 +0100 Subject: [PATCH 08/45] *cleaned and added a function to create analytic lines (in order to be inherited by other modules liek account_analytic_plans) bzr revid: qdp@tinyerp.com-20081124165126-rb1j9kscaa406siw --- addons/account/account.py | 21 ++++----------------- addons/account/account_move_line.py | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index a22b8a5c5fa..3df1dc622d1 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -1032,23 +1032,10 @@ class account_move(osv.osv): }, context, check=False) ok = False if ok: - obj_line=self.browse(cr, uid, ids[0]) - for move in self.browse(cr, uid, ids, context): - for obj_line in move.line_id: - #create analytic lines - if obj_line.analytic_account_id: - vals_lines={ - 'name': obj_line.name, - 'date': obj_line.date, - 'account_id': obj_line.analytic_account_id.id, - 'unit_amount':obj_line.quantity, - 'amount': obj_line.debit or obj_line.credit, - 'general_account_id': obj_line.account_id.id, - 'journal_id': obj_line.journal_id.analytic_journal_id.id, - 'ref': obj_line.ref, - 'move_id':obj_line.id - } - self.pool.get('account.analytic.line').create(cr,uid,vals_lines) + list_ids = [] + for tmp in move.line_id: + list_ids.append(tmp.id) + self.pool.get('account.move.line').create_analytic_lines(cr, uid, list_ids, context) return ok account_move() diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index d67073679d2..66ba78871fd 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -58,6 +58,24 @@ class account_move_line(osv.osv): del data[f] return data + def create_analytic_lines(self, cr, uid, ids, context={}): + for obj_line in self.browse(cr, uid, ids, context): + if obj_line.analytic_account_id: + amt = (obj_line.credit or 0.0) - (obj_line.debit or 0.0) + vals_lines={ + 'name': obj_line.name, + 'date': obj_line.date, + 'account_id': obj_line.analytic_account_id.id, + 'unit_amount':obj_line.quantity, + 'amount': amt, + 'general_account_id': obj_line.account_id.id, + 'journal_id': obj_line.journal_id.analytic_journal_id.id, + 'ref': obj_line.ref, + 'move_id':obj_line.id + } + new_id = self.pool.get('account.analytic.line').create(cr,uid,vals_lines) + return True + def _default_get(self, cr, uid, fields, context={}): # Compute simple values data = super(account_move_line, self).default_get(cr, uid, fields, context) From e130b17c9b01867760d947b06e8bdfaf0f40350a Mon Sep 17 00:00:00 2001 From: qdp Date: Mon, 24 Nov 2008 18:00:14 +0100 Subject: [PATCH 09/45] *bugfixed the analytic line creation (regarding to latest change: analytic lines are created when the move is validated) bzr revid: qdp@tinyerp.com-20081124170014-ukmrkrqhssgng1pp --- .../account_analytic_plans.py | 38 ++++--------------- 1 file changed, 7 insertions(+), 31 deletions(-) diff --git a/addons/account_analytic_plans/account_analytic_plans.py b/addons/account_analytic_plans/account_analytic_plans.py index b1e61d29cd7..e3190659e9a 100644 --- a/addons/account_analytic_plans/account_analytic_plans.py +++ b/addons/account_analytic_plans/account_analytic_plans.py @@ -280,21 +280,15 @@ class account_move_line(osv.osv): 'analytics_id':fields.many2one('account.analytic.plan.instance','Analytic Distribution'), } - def _analytic_update(self, cr, uid, ids, context): - if self.called: - self.called=False - return False - - obj_line=self.pool.get('account.analytic.line') - - for line in self.browse(cr, uid, ids, context): + def create_analytic_lines(self, cr, uid, ids, context={}): + super(account_move_line, self).create_analytic_lines(cr, uid, ids, context) + for line in self.browse(cr, uid, ids, context): if line.analytics_id: - toremove = obj_line.search(cr, uid, [('move_id','=',line.id)], context=context) + toremove = self.pool.get('account.analytic.line').search(cr, uid, [('move_id','=',line.id)], context=context) if toremove: - obj_line.unlink(cr, uid, toremove, context=context) - + obj_line.unlink(cr, uid, toremove, context=context) for line2 in line.analytics_id.account_ids: - val = (line.debit or 0.0) - (line.credit or 0.0) + val = (line.credit or 0.0) - (line.debit or 0.0) amt=val * (line2.rate/100) al_vals={ 'name': line.name, @@ -309,25 +303,7 @@ class account_move_line(osv.osv): 'ref': line.ref, } ali_id=self.pool.get('account.analytic.line').create(cr,uid,al_vals) - self.called=True - return True - - def write(self, cr, uid, ids, vals, context=None, check=True, update_check=True): - self.called=False - if ('analytics_id' in vals) and (not vals['analytics_id']): - for line in self.browse(cr, uid, ids, context): - toremove = self.pool.get('account.analytic.line').search(cr, uid, [('move_id','=',line.id)], context=context) - if toremove: - self.pool.get('account.analytic.line').unlink(cr, uid, toremove, context=context) - result = super(account_move_line, self).write(cr, uid, ids, vals, context, check, update_check) - self._analytic_update(cr, uid, ids, context) - return result - - def create(self, cr, uid, vals, context=None, check=True): - self.called=False - result = super(account_move_line, self).create(cr, uid, vals, context, check) - self._analytic_update(cr, uid, [result], context) - return result + return True account_move_line() From f2dc87ef31f7b3c0645b1c2ce94e3d064ef68afe Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Tue, 25 Nov 2008 00:23:10 +0100 Subject: [PATCH 10/45] improve bzr revid: fp@tinyerp.com-20081124232310-qry5vphgm9vn4dpz --- addons/base_contact/base_contact.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/base_contact/base_contact.py b/addons/base_contact/base_contact.py index 8b91e9b671c..022b6897ac7 100644 --- a/addons/base_contact/base_contact.py +++ b/addons/base_contact/base_contact.py @@ -118,7 +118,7 @@ class res_partner_job(osv.osv): 'name': fields.related('address_id','partner_id', type='many2one', relation='res.partner', string='Partner'), 'address_id':fields.many2one('res.partner.address','Address', required=True), 'contact_id':fields.many2one('res.partner.contact','Contact', required=True), - 'function_id': fields.many2one('res.partner.function','Job Title', required=True), + 'function_id': fields.many2one('res.partner.function','Job Title'), 'sequence_contact':fields.integer('Sequence (Contact)',help='order of importance of this address in the list of addresses of the linked contact'), 'sequence_partner':fields.integer('Sequence (Partner)',help='order of importance of this job title in the list of job title of the linked partner'), 'email': fields.char('E-Mail', size=240), From 1a96871e290faf1f3dd5b0706dfe7804fbfd8eab Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Tue, 25 Nov 2008 07:45:57 +0100 Subject: [PATCH 11/45] imporve bzr revid: fp@tinyerp.com-20081125064557-iwd1p3bzz3koxfab --- addons/base_contact/base_contact.py | 4 ++-- addons/stock/stock.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/base_contact/base_contact.py b/addons/base_contact/base_contact.py index 022b6897ac7..9fa43c42e43 100644 --- a/addons/base_contact/base_contact.py +++ b/addons/base_contact/base_contact.py @@ -116,8 +116,8 @@ class res_partner_job(osv.osv): _order = 'sequence_contact' _columns = { 'name': fields.related('address_id','partner_id', type='many2one', relation='res.partner', string='Partner'), - 'address_id':fields.many2one('res.partner.address','Address', required=True), - 'contact_id':fields.many2one('res.partner.contact','Contact', required=True), + 'address_id':fields.many2one('res.partner.address','Address'), + 'contact_id':fields.many2one('res.partner.contact','Contact', required=True, ondelete='cascade'), 'function_id': fields.many2one('res.partner.function','Job Title'), 'sequence_contact':fields.integer('Sequence (Contact)',help='order of importance of this address in the list of addresses of the linked contact'), 'sequence_partner':fields.integer('Sequence (Partner)',help='order of importance of this job title in the list of job title of the linked partner'), diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 63ecd5a354d..9d71666b104 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -101,7 +101,7 @@ class stock_location(osv.osv): 'child_ids': fields.one2many('stock.location', 'location_id', 'Contains'), 'chained_location_id': fields.many2one('stock.location', 'Chained Location If Fixed'), - 'chained_location_type': fields.selection([('','None'),('customer', 'Customer'),('fixed','Fixed Location')], + 'chained_location_type': fields.selection([('none','None'),('customer', 'Customer'),('fixed','Fixed Location')], 'Chained Location Type', required=True), 'chained_auto_packing': fields.selection( [('auto','Automatic Move'), ('manual','Manual Operation'),('transparent','Automatic No Step Added')], @@ -128,7 +128,7 @@ class stock_location(osv.osv): 'active': lambda *a: 1, 'usage': lambda *a: 'internal', 'allocation_method': lambda *a: 'fifo', - 'chained_location_type': lambda *a: '', + 'chained_location_type': lambda *a: 'none', 'chained_auto_packing': lambda *a: 'manual', 'posx': lambda *a: 0, 'posy': lambda *a: 0, From aac96b549f3d59f4d1f480a3a36b2c22118084ee Mon Sep 17 00:00:00 2001 From: "hda@tinyerp.com" <> Date: Tue, 25 Nov 2008 12:37:40 +0530 Subject: [PATCH 12/45] remove prints bzr revid: hda@tinyerp.com-20081125070740-wxunzjfblfyu20bh --- bin/osv/fields.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/osv/fields.py b/bin/osv/fields.py index d2d37eec55c..e2bb4a0b4ed 100644 --- a/bin/osv/fields.py +++ b/bin/osv/fields.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# OpenERP, Open Source Management Solution +# OpenERP, Open Source Management Solution # Copyright (C) 2004-2008 Tiny SPRL (). All Rights Reserved # $Id$ # From 4f9320c9a712cad9692b8296874221c4f707f47d Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Tue, 25 Nov 2008 11:11:20 +0100 Subject: [PATCH 13/45] [FIX] Use triple quote to create the label bzr revid: stephane@tinyerp.com-20081125101120-7f70uvztk1w21zav --- bin/addons/base/ir/workflow/print_instance.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/addons/base/ir/workflow/print_instance.py b/bin/addons/base/ir/workflow/print_instance.py index 826f753e594..c0d7847ffd1 100644 --- a/bin/addons/base/ir/workflow/print_instance.py +++ b/bin/addons/base/ir/workflow/print_instance.py @@ -38,7 +38,7 @@ def graph_get(cr, graph, wkf_id, nested=False, workitem={}): if n['subflow_id'] and nested: cr.execute('select * from wkf where id=%d', (n['subflow_id'],)) wkfinfo = cr.dictfetchone() - graph2 = pydot.Cluster('subflow'+str(n['subflow_id']), fontsize='12', label = "Subflow: "+n['name']+'\\nOSV: '+wkfinfo['osv']) + graph2 = pydot.Cluster('subflow'+str(n['subflow_id']), fontsize='12', label = """\"Subflow: %s\\nOSV: %s\"""" % ( n['name'], wkfinfo['osv']) ) (s1,s2) = graph_get(cr, graph2, n['subflow_id'], nested,workitem) graph.add_subgraph(graph2) actfrom[n['id']] = s2 From 008c0f0ee9a842b8f9b405f6e46c2ac78ae39412 Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Tue, 25 Nov 2008 11:35:00 +0100 Subject: [PATCH 14/45] [FIX] Use makedirs to create the directory for the file handler for the logging lp bug: https://launchpad.net/bugs/301865 fixed bzr revid: stephane@tinyerp.com-20081125103500-4txmseev1fp8m7vf --- bin/netsvc.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bin/netsvc.py b/bin/netsvc.py index 81e73ced921..dd8a5046f74 100644 --- a/bin/netsvc.py +++ b/bin/netsvc.py @@ -28,6 +28,7 @@ import SimpleXMLRPCServer, signal, sys, xmlrpclib import SocketServer import socket import logging +import logging.handlers import os _service = {} @@ -153,6 +154,9 @@ def init_logger(): logf = config['logfile'] # test if the directories exist, else create them try: + dirname = os.path.dirname(logf) + if not os.path.isdir(dirname): + res = os.makedirs(dirname) handler = logging.handlers.TimedRotatingFileHandler(logf,'D',1,30) except: sys.stderr.write("ERROR: couldn't create the logfile directory\n") From be08323c6207f01f0d1f1c20ecc8ee14e4f7d790 Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Tue, 25 Nov 2008 12:25:22 +0100 Subject: [PATCH 15/45] [FIX] Remove the password for the dump and the restore of database bzr revid: stephane@tinyerp.com-20081125112522-iglichvetklo3hyv --- bin/service/web_services.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/bin/service/web_services.py b/bin/service/web_services.py index 9128ca10a7d..2c6d2c1987c 100644 --- a/bin/service/web_services.py +++ b/bin/service/web_services.py @@ -163,11 +163,6 @@ class db(netsvc.Service): security.check_super(password) logger = netsvc.Logger() - if tools.config['db_password']: - logger.notifyChannel("web-service", netsvc.LOG_ERROR, - 'DUMP DB: %s doesn\'t work with password' % (db_name,)) - raise Exception, "Couldn't dump database with password" - cmd = ['pg_dump', '--format=c'] if tools.config['db_user']: cmd.append('--username=' + tools.config['db_user']) @@ -198,11 +193,6 @@ class db(netsvc.Service): 'RESTORE DB: %s already exists' % (db_name,)) raise Exception, "Database already exists" - if tools.config['db_password']: - logger.notifyChannel("web-service", netsvc.LOG_ERROR, - 'RESTORE DB: %s doesn\'t work with password' % (db_name,)) - raise Exception, "Couldn't restore database with password" - db = sql_db.db_connect('template1', serialize=1) db.truedb.autocommit() cr = db.cursor() From 07f8f4943d0e6d1b45e76498021f6b5ff8ed63dc Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Tue, 25 Nov 2008 12:43:00 +0100 Subject: [PATCH 16/45] [FIX] Use the logger for the message 'Address already in use' bzr revid: stephane@tinyerp.com-20081125114300-xb0cprmc9ked3pr5 --- bin/netsvc.py | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/bin/netsvc.py b/bin/netsvc.py index dd8a5046f74..b84f5cecb68 100644 --- a/bin/netsvc.py +++ b/bin/netsvc.py @@ -275,24 +275,19 @@ class GenericXMLRPCRequestHandler: raise xmlrpclib.Fault(s, tb_s) -class SimpleXMLRPCRequestHandler(GenericXMLRPCRequestHandler, - SimpleXMLRPCServer.SimpleXMLRPCRequestHandler): +class SimpleXMLRPCRequestHandler(GenericXMLRPCRequestHandler, SimpleXMLRPCServer.SimpleXMLRPCRequestHandler): SimpleXMLRPCServer.SimpleXMLRPCRequestHandler.rpc_paths = get_rpc_paths() - -class SimpleThreadedXMLRPCServer(SocketServer.ThreadingMixIn, - SimpleXMLRPCServer.SimpleXMLRPCServer): +class SimpleThreadedXMLRPCServer(SocketServer.ThreadingMixIn, SimpleXMLRPCServer.SimpleXMLRPCServer): def server_bind(self): try: - self.socket.setsockopt(socket.SOL_SOCKET, - socket.SO_REUSEADDR, 1) + self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) SimpleXMLRPCServer.SimpleXMLRPCServer.server_bind(self) except: - sys.stderr.write("ERROR: address already in use\n") + Logger().notifyChannel('init', LOG_ERROR, 'Address already in use') sys.exit(1) - class HttpDaemon(threading.Thread): def __init__(self, interface, port, secure=False): @@ -302,22 +297,19 @@ class HttpDaemon(threading.Thread): self.secure = secure if secure: from ssl import SecureXMLRPCServer - class SecureXMLRPCRequestHandler(GenericXMLRPCRequestHandler, - SecureXMLRPCServer.SecureXMLRPCRequestHandler): - SecureXMLRPCServer.SecureXMLRPCRequestHandler.rpc_paths = get_rpc_paths() - class SecureThreadedXMLRPCServer(SocketServer.ThreadingMixIn, - SecureXMLRPCServer.SecureXMLRPCServer): + class SecureXMLRPCRequestHandler(GenericXMLRPCRequestHandler, SecureXMLRPCServer.SecureXMLRPCRequestHandler): + SecureXMLRPCServer.SecureXMLRPCRequestHandler.rpc_paths = get_rpc_paths() + + class SecureThreadedXMLRPCServer(SocketServer.ThreadingMixIn, SecureXMLRPCServer.SecureXMLRPCServer): def server_bind(self): try: - self.socket.setsockopt(socket.SOL_SOCKET, - socket.SO_REUSEADDR, 1) + self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) SecureXMLRPCServer.SecureXMLRPCServer.server_bind(self) except: sys.stderr.write("ERROR: address already in use\n") sys.exit(1) - self.server = SecureThreadedXMLRPCServer((interface, port), SecureXMLRPCRequestHandler, 0) else: From d0fcc9d7ec7b682fd5b8428f668e4a7fe9fb5ccc Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Tue, 25 Nov 2008 14:23:25 +0100 Subject: [PATCH 17/45] [FIX] Use the prefix specified by the user at the installation lp bug: https://launchpad.net/bugs/301561 fixed bzr revid: stephane@tinyerp.com-20081125132325-zhtz3nj34ejnn7vi --- setup.py | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/setup.py b/setup.py index 129df517e59..3f177854dcd 100755 --- a/setup.py +++ b/setup.py @@ -35,7 +35,8 @@ import glob from stat import ST_MODE from distutils.core import setup, Command -from distutils.command.install_scripts import install_scripts +from distutils.command.install import install +#from distutils.command.install_scripts import install_scripts from distutils.file_util import copy_file if os.name == 'nt': @@ -147,15 +148,17 @@ def data_files(): check_modules() -# create startup script -start_script = \ -"#!/bin/sh\n\ -cd %s/lib/python%s/site-packages/openerp-server\n\ -exec %s ./openerp-server.py $@\n" % (sys.prefix, py_short_version, sys.executable) -# write script -f = open('openerp-server', 'w') -f.write(start_script) -f.close() + +class openerp_server_install(install): + def run(self): + # create startup script + start_script = "#!/bin/sh\ncd %s\nexec %s ./openerp-server.py $@\n" % (opj(self.install_libbase, "openerp-server"), sys.executable) + # write script + f = open('openerp-server', 'w') + f.write(start_script) + f.close() + + install.run(self) options = { "py2exe": { @@ -179,6 +182,7 @@ setup(name = name, classifiers = filter(None, classifiers.split("\n")), license = license, data_files = data_files(), + cmdclass = { 'install' : openerp_server_install }, scripts = ['openerp-server'], packages = ['openerp-server', 'openerp-server.addons', From 282147bca3dbf7b82b051070315041bf509390b5 Mon Sep 17 00:00:00 2001 From: Harshad Modi Date: Tue, 25 Nov 2008 18:57:44 +0530 Subject: [PATCH 18/45] pso's work on process data bzr revid: hmo@tinyerp.com-20081125132744-4mvhor10zzfrhly2 --- addons/account/__terp__.py | 3 +- .../process/customer_invoice_process.xml | 195 ++++++++++++++ addons/account/process/statement_process.xml | 81 +++--- .../process/supplier_invoice_process.xml | 175 ++++++++++++ addons/base_contact/__terp__.py | 5 +- .../process/base_contact_process.xml | 91 +++++++ .../process/crm_configuration_process.xml | 230 +++++++++------- addons/hr/process/hr_process.xml | 18 +- addons/hr_expense/__terp__.py | 1 + .../hr_expense/process/hr_expense_process.xml | 187 +++++++++++++ .../process/hr_holidays_process.xml | 162 ++++++++++- addons/membership/__terp__.py | 3 +- .../membership/process/membership_process.xml | 139 ++++++++++ addons/mrp/__terp__.py | 2 +- addons/mrp/process/procurement_process.xml | 226 ++++++++-------- addons/product/process/product_process.xml | 48 +--- addons/project/process/task_process.xml | 2 +- .../process/project_mrp_process.xml | 33 +-- addons/purchase/process/purchase_process.xml | 70 +++-- addons/sale/process/sale_process.xml | 251 ++++++++++-------- addons/sale_crm/process/sale_crm_process.xml | 56 +++- addons/stock/__terp__.py | 1 + addons/stock/process/stock_process.xml | 47 ++++ 23 files changed, 1529 insertions(+), 497 deletions(-) create mode 100644 addons/account/process/customer_invoice_process.xml create mode 100644 addons/account/process/supplier_invoice_process.xml create mode 100644 addons/base_contact/process/base_contact_process.xml create mode 100644 addons/hr_expense/process/hr_expense_process.xml create mode 100644 addons/membership/process/membership_process.xml create mode 100644 addons/stock/process/stock_process.xml diff --git a/addons/account/__terp__.py b/addons/account/__terp__.py index 40a4b2d1d5d..136731fbac6 100644 --- a/addons/account/__terp__.py +++ b/addons/account/__terp__.py @@ -59,7 +59,8 @@ "project/project_report.xml", "product_view.xml", "account_assert_test.xml", - "process/invoice_process.xml", + "process/customer_invoice_process.xml", + "process/supplier_invoice_process.xml", "process/statement_process.xml", ], "translations" : { diff --git a/addons/account/process/customer_invoice_process.xml b/addons/account/process/customer_invoice_process.xml new file mode 100644 index 00000000000..35878c77fd3 --- /dev/null +++ b/addons/account/process/customer_invoice_process.xml @@ -0,0 +1,195 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/addons/account/process/statement_process.xml b/addons/account/process/statement_process.xml index 3ee13ace8d5..89710174453 100644 --- a/addons/account/process/statement_process.xml +++ b/addons/account/process/statement_process.xml @@ -26,6 +26,17 @@ + + + + + + + + + + + @@ -43,47 +54,24 @@ - + - - - - - - - - - - - - + - + - - - - - - - - - - - - - - @@ -95,6 +83,15 @@ + + + + + + + + + @@ -110,28 +107,10 @@ - + - - - - - - - - - - - - - - - - - - @@ -141,9 +120,11 @@ - + + + diff --git a/addons/account/process/supplier_invoice_process.xml b/addons/account/process/supplier_invoice_process.xml new file mode 100644 index 00000000000..e43ee096ebc --- /dev/null +++ b/addons/account/process/supplier_invoice_process.xml @@ -0,0 +1,175 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/addons/base_contact/__terp__.py b/addons/base_contact/__terp__.py index b8a419e1ee9..581dfe8b26b 100644 --- a/addons/base_contact/__terp__.py +++ b/addons/base_contact/__terp__.py @@ -40,14 +40,15 @@ Pay attention that this module converts the existing addresses into "addresses + contacts". It means that some fields of the addresses will be missing (like the contact name), since these are supposed to be defined in an other object. """, - "depends" : ["base"], + "depends" : ["base", "process"], "init_xml" : [], "demo_xml" : [ "base_contact_demo.xml" ], "update_xml" : [ "security/ir.model.access.csv", - 'base_contact_view.xml' + 'base_contact_view.xml', + "process/base_contact_process.xml" ], "active": False, "installable": True diff --git a/addons/base_contact/process/base_contact_process.xml b/addons/base_contact/process/base_contact_process.xml new file mode 100644 index 00000000000..c446e91b104 --- /dev/null +++ b/addons/base_contact/process/base_contact_process.xml @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/addons/crm_configuration/process/crm_configuration_process.xml b/addons/crm_configuration/process/crm_configuration_process.xml index 84155528f92..2218610390e 100644 --- a/addons/crm_configuration/process/crm_configuration_process.xml +++ b/addons/crm_configuration/process/crm_configuration_process.xml @@ -1,106 +1,132 @@ - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/addons/hr/process/hr_process.xml b/addons/hr/process/hr_process.xml index 1afb90f3020..5984ed7e924 100644 --- a/addons/hr/process/hr_process.xml +++ b/addons/hr/process/hr_process.xml @@ -17,9 +17,11 @@ --> + - + @@ -54,11 +56,20 @@ - + - + + + + + + + + + + @@ -76,7 +87,6 @@ - diff --git a/addons/hr_expense/__terp__.py b/addons/hr_expense/__terp__.py index 7787db5e235..1cb45d7cade 100644 --- a/addons/hr_expense/__terp__.py +++ b/addons/hr_expense/__terp__.py @@ -48,6 +48,7 @@ "hr_expense_workflow.xml", "hr_expense_view.xml", "hr_expense_report.xml", + "process/hr_expense_process.xml" ], "active": False, "installable": True diff --git a/addons/hr_expense/process/hr_expense_process.xml b/addons/hr_expense/process/hr_expense_process.xml new file mode 100644 index 00000000000..5a00f2dc646 --- /dev/null +++ b/addons/hr_expense/process/hr_expense_process.xml @@ -0,0 +1,187 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/addons/hr_holidays/process/hr_holidays_process.xml b/addons/hr_holidays/process/hr_holidays_process.xml index 4cbddc9c423..2cdb83885ab 100644 --- a/addons/hr_holidays/process/hr_holidays_process.xml +++ b/addons/hr_holidays/process/hr_holidays_process.xml @@ -2,43 +2,177 @@ - - + + + + + + + + + + + + + + + + + + + + + + - - - + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + + + + + + + + + + + + + + - - - + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/addons/membership/__terp__.py b/addons/membership/__terp__.py index 16172f9f2e4..8e80e24341e 100644 --- a/addons/membership/__terp__.py +++ b/addons/membership/__terp__.py @@ -36,7 +36,8 @@ ], "update_xml" : [ "security/ir.model.access.csv", - "membership_view.xml","membership_wizard.xml" + "membership_view.xml","membership_wizard.xml", + "process/membership_process.xml" ], "active" : False, "installable" : True, diff --git a/addons/membership/process/membership_process.xml b/addons/membership/process/membership_process.xml new file mode 100644 index 00000000000..5e4b9e0703b --- /dev/null +++ b/addons/membership/process/membership_process.xml @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/addons/mrp/__terp__.py b/addons/mrp/__terp__.py index 98c88413e3c..c76c82296d5 100644 --- a/addons/mrp/__terp__.py +++ b/addons/mrp/__terp__.py @@ -25,7 +25,7 @@ "author" : "Tiny", "website" : "http://tinyerp.com/module_mrp.html", "category" : "Generic Modules/Production", - "depends" : ["stock", "hr", "purchase", "product", "process"], + "depends" : ["stock", "hr", "purchase", "product"], "description": """ This is the base module to manage the manufacturing process in Tiny ERP. diff --git a/addons/mrp/process/procurement_process.xml b/addons/mrp/process/procurement_process.xml index 866ad784349..d05eb28eaef 100644 --- a/addons/mrp/process/procurement_process.xml +++ b/addons/mrp/process/procurement_process.xml @@ -15,6 +15,16 @@ Process Node --> + + + + + + + + + + @@ -25,26 +35,34 @@ - - - + + + - - + + - - - - - - - - - - + + + + + + + + + + + + + + + + + + @@ -80,40 +98,40 @@ - - - - - - - - - - - - + - - - - - - - - - - + + + + + + + + + + - - + + + + + + + + + + + + + @@ -126,7 +144,7 @@ - + @@ -152,8 +170,8 @@ - - + + @@ -164,14 +182,14 @@ - - + + - + @@ -183,6 +201,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -207,10 +252,10 @@ - + - + @@ -219,17 +264,7 @@ - - - - - - - - - - - + @@ -239,6 +274,15 @@ + + + + + + + + + @@ -247,22 +291,22 @@ - - + + - - - - + + + + - + - + @@ -273,19 +317,10 @@ - + - - - - - - - - - @@ -304,15 +339,6 @@ - - - - - - - - - @@ -335,34 +361,6 @@ Process Action --> - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -404,6 +402,6 @@ - + \ No newline at end of file diff --git a/addons/product/process/product_process.xml b/addons/product/process/product_process.xml index d7e985eca7d..1264cf09f33 100644 --- a/addons/product/process/product_process.xml +++ b/addons/product/process/product_process.xml @@ -29,38 +29,16 @@ - + - - + + - - - - - - - - - - - - - - - - - - - - - - @@ -72,23 +50,5 @@ - - - - - - - - - - - - - - - - - - diff --git a/addons/project/process/task_process.xml b/addons/project/process/task_process.xml index f987ba07af3..c5179ff6e23 100644 --- a/addons/project/process/task_process.xml +++ b/addons/project/process/task_process.xml @@ -39,7 +39,7 @@ - + diff --git a/addons/project_mrp/process/project_mrp_process.xml b/addons/project_mrp/process/project_mrp_process.xml index 125d325f223..3d08bd11394 100644 --- a/addons/project_mrp/process/project_mrp_process.xml +++ b/addons/project_mrp/process/project_mrp_process.xml @@ -6,12 +6,12 @@ Process Node --> - + - - + + @@ -33,35 +33,24 @@ - - + + - - - - - - - - - - + - - - - + + + + @@ -79,7 +68,7 @@ - + diff --git a/addons/purchase/process/purchase_process.xml b/addons/purchase/process/purchase_process.xml index 23891fda515..0d17b36dc06 100644 --- a/addons/purchase/process/purchase_process.xml +++ b/addons/purchase/process/purchase_process.xml @@ -21,8 +21,8 @@ - - + + @@ -32,19 +32,30 @@ - - + + + + + + + + + + + + + - - + + @@ -54,8 +65,8 @@ - - + + @@ -65,8 +76,8 @@ - - + + @@ -77,8 +88,8 @@ - - + + @@ -88,14 +99,32 @@ - - + + - + + + + + + + + + + + + + + + + + @@ -122,6 +151,15 @@ + + + + + + + + + @@ -164,7 +202,7 @@ - + diff --git a/addons/sale/process/sale_process.xml b/addons/sale/process/sale_process.xml index 973c39ec2dc..231d1900ff7 100644 --- a/addons/sale/process/sale_process.xml +++ b/addons/sale/process/sale_process.xml @@ -1,161 +1,188 @@ - - - + - - + + - - - + - - - + + + - object.state=='draft' + - + - - - + + + - object.state in ('draft','waiting_date','manual','progress','shipping_except','invoice_except','done','cancel') + - + - - - + + + - object.state=='draft' - + + - - + + + - object.state in ('waiting_date','manual','progress') + + + + + + + + + + + + + - - + + + - object.state in ('assigned', 'confirmed') + + - - - + + + - object.state in ('done') + + - - - + + + + + - - - + + + + - - - object.order_policy=='postpaid' - + + - - - + - + - + - - + + - + - - + + - - + + - - - + + + + + + + + + + + - - + + - - + + @@ -163,103 +190,103 @@ - - + + - + - - + + - - + + - + - - + + - - - + - - - + + + - - - + + + - + - - - + + + - - - + + + - - - + + + - + - - - + + + - - - + + + - - - + + + - + - - - + + + - - - - - + + + + + - + diff --git a/addons/sale_crm/process/sale_crm_process.xml b/addons/sale_crm/process/sale_crm_process.xml index 6aaa146b250..307b1cfd618 100644 --- a/addons/sale_crm/process/sale_crm_process.xml +++ b/addons/sale_crm/process/sale_crm_process.xml @@ -2,25 +2,55 @@ - - - - - - + + + + + + + + - + - + + + + + + + + + + + + + + - - - - + + + + - + + + + + + + + + + + + \ No newline at end of file diff --git a/addons/stock/__terp__.py b/addons/stock/__terp__.py index d4a14976c2b..1937aad9428 100644 --- a/addons/stock/__terp__.py +++ b/addons/stock/__terp__.py @@ -42,6 +42,7 @@ "report_stock_view.xml", "security/stock_security.xml", "security/ir.model.access.csv", + "process/stock_process.xml" ], "active": False, "installable": True diff --git a/addons/stock/process/stock_process.xml b/addons/stock/process/stock_process.xml new file mode 100644 index 00000000000..aef4e3b89aa --- /dev/null +++ b/addons/stock/process/stock_process.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From fac5d5213a2550d6c48c4e12d6fa166062f2f4da Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Tue, 25 Nov 2008 14:35:16 +0100 Subject: [PATCH 19/45] [FIX] document module: avoid exception when check non openerp databases lp bug: https://launchpad.net/bugs/301004 fixed bzr revid: christophe@tinyerp.com-20081125133516-78ivqrebot9pezuh --- addons/document/ftpserver/abstracted_fs.py | 26 +++++++++++++++------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/addons/document/ftpserver/abstracted_fs.py b/addons/document/ftpserver/abstracted_fs.py index fe624da7de4..6892a5f729d 100644 --- a/addons/document/ftpserver/abstracted_fs.py +++ b/addons/document/ftpserver/abstracted_fs.py @@ -68,15 +68,25 @@ class abstracted_fs: def db_list(self): s = netsvc.LocalService('db') result = s.list() - self.db_name_list=[] + self.db_name_list = [] for db_name in result: - db = pooler.get_db_only(db_name) - cr = db.cursor() - cr.execute("select id from ir_module_module where name like 'document%' and state='installed' ") - res=cr.fetchone() - if res and len(res): - self.db_name_list.append(db_name) - cr.close() + db, cr = None, None + try: + db = pooler.get_db_only(db_name) + cr = db.cursor() + cr.execute("SELECT 1 FROM pg_class WHERE relkind = 'r' AND relname = 'ir_module_module'") + if not cr.fetchone(): + continue + + cr.execute("select id from ir_module_module where name like 'document%' and state='installed' ") + res = cr.fetchone() + if res and len(res): + self.db_name_list.append(db_name) + finally: + if cr is not None: + cr.close() + if db is not None: + pooler.close_db(db_name) return self.db_name_list # Ok From 71885d3625495fbf197fbe0e181047d296f6804c Mon Sep 17 00:00:00 2001 From: "hda@tinyerp.com" <> Date: Tue, 25 Nov 2008 19:20:41 +0530 Subject: [PATCH 20/45] implement maintenance bzr revid: hda@tinyerp.com-20081125135041-peehjywthggx8ua9 --- bin/addons/base/__init__.py | 4 +- bin/addons/base/__terp__.py | 4 +- bin/addons/base/maintenance/__init__.py | 33 ++++++ bin/addons/base/maintenance/maintenance.py | 111 ++++++++++++++++++ .../base/maintenance/maintenance_security.xml | 14 +++ .../base/maintenance/maintenance_view.xml | 41 +++++++ bin/addons/base/security/ir.model.access.csv | 1 + 7 files changed, 205 insertions(+), 3 deletions(-) create mode 100755 bin/addons/base/maintenance/__init__.py create mode 100755 bin/addons/base/maintenance/maintenance.py create mode 100644 bin/addons/base/maintenance/maintenance_security.xml create mode 100755 bin/addons/base/maintenance/maintenance_view.xml diff --git a/bin/addons/base/__init__.py b/bin/addons/base/__init__.py index 777f0f5a371..0349891aa55 100644 --- a/bin/addons/base/__init__.py +++ b/bin/addons/base/__init__.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# OpenERP, Open Source Management Solution +# OpenERP, Open Source Management Solution # Copyright (C) 2004-2008 Tiny SPRL (). All Rights Reserved # $Id$ # @@ -23,7 +23,7 @@ import ir import module import res - +import maintenance # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/bin/addons/base/__terp__.py b/bin/addons/base/__terp__.py index d1bd53f8252..380fb16c55c 100644 --- a/bin/addons/base/__terp__.py +++ b/bin/addons/base/__terp__.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# OpenERP, Open Source Management Solution +# OpenERP, Open Source Management Solution # Copyright (C) 2004-2008 Tiny SPRL (). All Rights Reserved # $Id$ # @@ -32,6 +32,7 @@ "base_menu.xml", "security/base_security.xml", "res/res_security.xml", + "maintenance/maintenance_security.xml", ], "demo_xml" : [ "base_demo.xml", @@ -59,6 +60,7 @@ "res/partner/partner_data.xml", "res/ir_property_view.xml", "security/base_security.xml", + "maintenance/maintenance_view.xml", "security/ir.model.access.csv", ], "active": True, diff --git a/bin/addons/base/maintenance/__init__.py b/bin/addons/base/maintenance/__init__.py new file mode 100755 index 00000000000..876c0e1dc3c --- /dev/null +++ b/bin/addons/base/maintenance/__init__.py @@ -0,0 +1,33 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Copyright (c) 2004-2008 Tiny SPRL (http://tiny.be) All Rights Reserved. +# +# $Id$ +# +# WARNING: This program as such is intended to be used by professional +# programmers who take the whole responsability of assessing all potential +# consequences resulting from its eventual inadequacies and bugs +# End users who are looking for a ready-to-use solution with commercial +# garantees and support are strongly adviced to contract a Free Software +# Service Company +# +# This program is Free Software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +############################################################################### + +import maintenance + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + diff --git a/bin/addons/base/maintenance/maintenance.py b/bin/addons/base/maintenance/maintenance.py new file mode 100755 index 00000000000..589bd18354c --- /dev/null +++ b/bin/addons/base/maintenance/maintenance.py @@ -0,0 +1,111 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved. +# +# $Id$ +# +# WARNING: This program as such is intended to be used by professional +# programmers who take the whole responsability of assessing all potential +# consequences resulting from its eventual inadequacies and bugs +# End users who are looking for a ready-to-use solution with commercial +# garantees and support are strongly adviced to contract a Free Software +# Service Company +# +# This program is Free Software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################## + +from osv import osv, fields +import pooler +import time +import math + +from tools import config +import xmlrpclib + +class maintenance_contract(osv.osv): + _name = "maintenance.contract" + _description = "Maintenance Contract" + _columns = { + 'name' : fields.char('Name', size=256), + 'contract_date' : fields.date('Date'), + 'password' : fields.char('password', size=64, invisible=True), + } + + _defaults = { + 'password' : lambda obj,cr,uid,context={} : '', + 'contract_date':lambda *a: time.strftime('%Y-%m-%d'), + } + def _test_maintenance(self, cr, uid, ids, context): + remote_db='trunk' + remote_server='localhost' + port=8069 + module_obj=self.pool.get('ir.module.module') + contract_obj=self.pool.get('maintenance.contract') + module_ids=module_obj.search(cr, uid, [('state','=','installed')]) + modules=module_obj.read(cr, uid, module_ids, ['name','installed_version']) + contract_obj=contract_obj.read(cr, uid, ids[0]) + local_url = 'http://%s:%d/xmlrpc/common'%(remote_server,port) + rpc = xmlrpclib.ServerProxy(local_url) + ruid = rpc.login(remote_db, 'admin', 'admin') + local_url = 'http://%s:%d/xmlrpc/object'%(remote_server,port) + rrpc = xmlrpclib.ServerProxy(local_url) + try: + result=rrpc.execute(remote_db, ruid, 'admin', 'maintenance.maintenance', 'check_contract' , modules,contract_obj) + except: + raise osv.except_osv(_('Maintenance Error !'),('''Module Maintenance_Editor is not installed at server : %s Database : %s'''%(remote_server,remote_db))) + if context.get('active_id',False): + if result['status']=='ko': + raise osv.except_osv(_('Maintenance Error !'),('''Maintenance Contract +----------------------------------------------------------- +You have no valid maintenance contract! If you are using +Open ERP, it is highly suggested to take maintenance contract. +The maintenance program offers you: +* Migrations on new versions, +* Bugfix guarantee, +* Monthly announces of bugs, +* Security alerts, +* Access to the customer portal. +* Check the maintenance contract (www.openerp.com)''')) + elif result['status']=='partial': + raise osv.except_osv(_('Maintenance Error !'),('''Maintenance Contract +----------------------------------------------------------- +You have a maintenance contract, But you installed modules those +are not covered by your maintenance contract: +'''+','.join(result['modules'])+''' +It means we can not offer you the garantee of maintenance on +your whole installation. +The maintenance program includes: +* Migrations on new versions, +* Bugfix guarantee, +* Monthly announces of bugs, +* Security alerts, +* Access to the customer portal. + +To include these modules in your maintenance contract, you should +extend your contract with the editor. We will review and validate +your installed modules. + +* Extend your maintenance to the modules you used. +* Check your maintenance contract''')) + else: + raise osv.except_osv(_('Valid Maintenance Contract !'),('''Your Maintenance Contract is up to date''')) + return result + +maintenance_contract() + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + diff --git a/bin/addons/base/maintenance/maintenance_security.xml b/bin/addons/base/maintenance/maintenance_security.xml new file mode 100644 index 00000000000..bb477595ddd --- /dev/null +++ b/bin/addons/base/maintenance/maintenance_security.xml @@ -0,0 +1,14 @@ + + + + + + Maintenance Manager + + + + + + + + diff --git a/bin/addons/base/maintenance/maintenance_view.xml b/bin/addons/base/maintenance/maintenance_view.xml new file mode 100755 index 00000000000..c79683de472 --- /dev/null +++ b/bin/addons/base/maintenance/maintenance_view.xml @@ -0,0 +1,41 @@ + + + + + + maintenance.contract.tree + maintenance.contract + tree + + + + + + + + + + maintenance.contract.form + maintenance.contract + form + +
+ + + +