From 8c66ca9e28f977bca637d2e1d797cae82f14eecb Mon Sep 17 00:00:00 2001 From: qdp Date: Wed, 1 Oct 2008 15:57:13 +0200 Subject: [PATCH 01/14] *bugfixed the _rec_name of payment_order bzr revid: qdp@tinyerp.com-20081001135713-9ucvphqs78r81qj1 --- addons/account_payment/payment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account_payment/payment.py b/addons/account_payment/payment.py index 22ca132453c..76f1fdb6319 100644 --- a/addons/account_payment/payment.py +++ b/addons/account_payment/payment.py @@ -82,7 +82,7 @@ payment_mode() class payment_order(osv.osv): _name = 'payment.order' _description = 'Payment Order' - _rec_name = 'date' + _rec_name = 'reference' def get_wizard(self,type): logger = netsvc.Logger() From 4bbe2cfc1fc20bd0590ac35c6f4591a191d7b95d Mon Sep 17 00:00:00 2001 From: qdp Date: Wed, 1 Oct 2008 16:00:03 +0200 Subject: [PATCH 02/14] *added an integrity check of the iban account number *added an automatic formatting of the iban account number in order to comply with schema *added a function the compute the account bank number from the iban account number accordingly to the country rule *added comments *overall improvements bzr revid: qdp@tinyerp.com-20081001140003-pgvbxcr52jpwxnj6 --- addons/base_iban/base_iban.py | 87 ++++++++++++++++++++++++++++++++--- 1 file changed, 80 insertions(+), 7 deletions(-) diff --git a/addons/base_iban/base_iban.py b/addons/base_iban/base_iban.py index 870d7cb7317..d7ccef61ad2 100644 --- a/addons/base_iban/base_iban.py +++ b/addons/base_iban/base_iban.py @@ -31,11 +31,52 @@ import netsvc from osv import fields, osv +def _format_iban(string): + ''' + This function removes all characters from given 'string' that isn't a alpha numeric and converts it to lower case. + ''' + res = "" + for char in string: + if char.isalnum(): + res += char.lower() + return res + class res_partner_bank(osv.osv): _inherit = "res.partner.bank" - _columns = { - 'iban': fields.char('IBAN', size=34, readonly=True, help="International Bank Account Number"), - } + + def create(self, cr, uid, vals, context={}): + #overwrite to format the iban number correctly + if vals.has_key('iban'): + vals['iban'] = _format_iban(vals['iban']) + return super(res_partner_bank, self).create(cr, uid, vals, context) + + def write(self, cr, uid, ids, vals, context={}): + #overwrite to format the iban number correctly + if vals.has_key('iban'): + vals['iban'] = _format_iban(vals['iban']) + return super(res_partner_bank, self).write(cr, uid, ids, vals, context) + + def check_iban(self, cr, uid, ids): + ''' + Check the IBAN number + ''' + for bank_acc in self.browse(cr, uid, ids): + if not bank_acc.iban: + continue + iban =_format_iban(bank_acc.iban) + #the four first digits have to be shifted to the end + iban = iban[4:] + iban[:4] + #letters have to be transformed into numbers (a = 10, b = 11, ...) + iban2 = "" + for char in iban: + if char.isalpha(): + iban2 += str(ord(char)-87) + else: + iban2 += char + #iban is correct if modulo 97 == 1 + if not int(iban2) % 97 == 1: + return False + return True def name_get(self, cr, uid, ids, context=None): res = [] @@ -48,18 +89,50 @@ class res_partner_bank(osv.osv): res += super(res_partner_bank, self).name_get(cr, uid, to_check_ids, context) return res - def search(self, cr, uid, args, offset=0, limit=None, order=None, - context=None, count=False): - res = super(res_partner_bank,self).search(cr, uid, args, offset, limit, - order, context=context, count=count) + def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False): + #overwrite the search method in order to search not only on bank type == basic account number but also on type == iban + res = super(res_partner_bank,self).search(cr, uid, args, offset, limit, order, context=context, count=count) if filter(lambda x:x[0]=='acc_number' ,args): + #get the value of the search iban_value = filter(lambda x:x[0]=='acc_number' ,args)[0][2] + #get the other arguments of the search args1 = filter(lambda x:x[0]!='acc_number' ,args) + #add the new criterion args1 += [('iban','ilike',iban_value)] + #append the results to the older search res += super(res_partner_bank,self).search(cr, uid, args1, offset, limit, order, context=context, count=count) return res + def get_bban_from_iban(self, cr, uid, ids, context=None): + ''' + This function returns the bank account number computed from the iban account number, thanks to the mapping_list dictionary that contains the rules associated to its country. + ''' + res = {} + mapping_list = { + #TODO add rules for others countries + 'be': lambda x: x[4:], + 'fr': lambda x: x[14:], + 'ch': lambda x: x[9:], + 'gb': lambda x: x[14:], + } + for record in self.browse(cr, uid, ids, context): + if not record.iban: + res[record.id] = False + continue + res[record.id] = False + for code, function in mapping_list.items(): + if record.iban.lower().startswith(code): + res[record.id] = function(record.iban) + break + return res + + _columns = { + 'iban': fields.char('IBAN', size=34, readonly=True, help="International Bank Account Number"), + } + + _constraints = [(check_iban, "The IBAN number doesn't seem to be correct.", ["iban"])] + res_partner_bank() From 5598a8380756c4fdcd47c53ace6fe4d7b4bfe76c Mon Sep 17 00:00:00 2001 From: qdp Date: Wed, 1 Oct 2008 17:15:29 +0200 Subject: [PATCH 03/14] *glicth corrected on wizard names bzr revid: qdp@tinyerp.com-20081001151529-nllwqi8fni274wzw --- addons/l10n_be/l10n_be_wizard.xml | 12 ++++++------ addons/l10n_be/wizard/account_vat_declaration.py | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/addons/l10n_be/l10n_be_wizard.xml b/addons/l10n_be/l10n_be_wizard.xml index 5ae595ecc01..69dd19cb782 100644 --- a/addons/l10n_be/l10n_be_wizard.xml +++ b/addons/l10n_be/l10n_be_wizard.xml @@ -6,21 +6,21 @@ model="res.partner" name="list.vat.detail" menu="False" - id="base.partner_wizard_vat"/> + id="partner_wizard_vat"/> + id="partner_wizard_vat_menu"/> + id="wizard_xml_vat_declaration"/> diff --git a/addons/l10n_be/wizard/account_vat_declaration.py b/addons/l10n_be/wizard/account_vat_declaration.py index cd673b3e482..f71121adf57 100644 --- a/addons/l10n_be/wizard/account_vat_declaration.py +++ b/addons/l10n_be/wizard/account_vat_declaration.py @@ -98,4 +98,4 @@ class wizard_vat_declaration(wizard.interface): } } -wizard_vat_declaration('wizard.account.vat.declaration') +wizard_vat_declaration('wizard.account.xml.vat.declaration') From 524228e3f8c84b8727dcba1a9b3ef0fc4a98bbf6 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Thu, 2 Oct 2008 08:38:12 +0200 Subject: [PATCH 04/14] fix po file bzr revid: christophe@tinyerp.com-20081002063812-fg9ovw4l5ihkge5g --- addons/mrp/i18n/fr_FR.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mrp/i18n/fr_FR.po b/addons/mrp/i18n/fr_FR.po index d031b2ae17c..3e96a958e75 100644 --- a/addons/mrp/i18n/fr_FR.po +++ b/addons/mrp/i18n/fr_FR.po @@ -1205,7 +1205,7 @@ msgstr "Index numériques" #. module: mrp #: field:mrp.routing,location_id:0 msgid "Production Location" -msgstr "Emplacement de production\\"" +msgstr "Emplacement de production" #. module: mrp #: selection:stock.warehouse.orderpoint,logic:0 From 48704ddb2c64b193e9c930c329224acc36adcd15 Mon Sep 17 00:00:00 2001 From: qdp Date: Thu, 2 Oct 2008 15:16:03 +0200 Subject: [PATCH 05/14] *added demo data for base_contact module bzr revid: qdp@tinyerp.com-20081002131603-9rfo6930115i6ab7 --- addons/base_contact/__terp__.py | 5 +- addons/base_contact/base_contact_demo.xml | 326 ++++++++++++++++++++++ 2 files changed, 329 insertions(+), 2 deletions(-) create mode 100644 addons/base_contact/base_contact_demo.xml diff --git a/addons/base_contact/__terp__.py b/addons/base_contact/__terp__.py index 3b1e3af9e69..a267a7631c0 100644 --- a/addons/base_contact/__terp__.py +++ b/addons/base_contact/__terp__.py @@ -13,15 +13,16 @@ *contacts working at several adresses (possibly for different partners), *contacts with possibly different functions for each of its job's addresses - It also add a new menuitem located in + It also add new menuitems located in Partners \ Contacts + Partners \ Functions 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"], "init_xml" : [], - "demo_xml" : [], + "demo_xml" : ["base_contact_demo.xml"], "update_xml" : [ "security/ir.model.access.csv", 'base_contact_view.xml' diff --git a/addons/base_contact/base_contact_demo.xml b/addons/base_contact/base_contact_demo.xml new file mode 100644 index 00000000000..6efa01a7267 --- /dev/null +++ b/addons/base_contact/base_contact_demo.xml @@ -0,0 +1,326 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -1 + + + + + + + + + + + + 5 + + + + + + + 5 + + + + + + + 1 + + + From 8c1994a571aab2f55be8d7100c30bc2bcada58fc Mon Sep 17 00:00:00 2001 From: qdp Date: Thu, 2 Oct 2008 15:37:03 +0200 Subject: [PATCH 06/14] *typos corrected *added a wizard that check whenever a registration is confirmed that there is enough available places and the warn the user if no, giving him the choice to continue or cancell the registration's confirmation. bzr revid: qdp@tinyerp.com-20081002133703-vu7l6lqld6xkj094 --- addons/event/event.py | 13 +--- addons/event/event_view.xml | 4 +- addons/event/event_wizard.xml | 79 +++++++++---------- addons/event/wizard/__init__.py | 1 + addons/event/wizard/confirm_registration.py | 86 +++++++++++++++++++++ 5 files changed, 127 insertions(+), 56 deletions(-) create mode 100644 addons/event/wizard/confirm_registration.py diff --git a/addons/event/event.py b/addons/event/event.py index adfe5b04386..2450441349a 100644 --- a/addons/event/event.py +++ b/addons/event/event.py @@ -134,8 +134,8 @@ class event(osv.osv): 'date_begin': fields.datetime('Beginning date', required=True), 'date_end': fields.datetime('Ending date', required=True), 'state': fields.selection([('draft','Draft'),('confirm','Confirmed'),('done','Done'),('cancel','Canceled')], 'Status', readonly=True, required=True), - 'mail_auto_registr':fields.boolean('Mail Auto Register',help='A mail is send when the registration is confirmed'), - 'mail_auto_confirm':fields.boolean('Mail Auto Confirm',help='A mail is send when the event is confimed'), + 'mail_auto_registr':fields.boolean('Mail Auto Register',help='A mail is sent when the registration is confirmed'), + 'mail_auto_confirm':fields.boolean('Mail Auto Confirm',help='A mail is sent when the event is confimed'), 'mail_registr':fields.text('Mail Register',help='Template for the mail'), 'mail_confirm':fields.text('Mail Confirm',help='Template for the mail'), 'budget_id':fields.many2one('account.budget.post','Budget'), @@ -163,13 +163,6 @@ class event_registration(osv.osv): obj.create(cr, uid, data, context) return True - def button_reg_open(self, cr, uid, ids, *args): - self.write(cr, uid, ids, {'state':'open',}) - cases = self.browse(cr, uid, ids) - self._history(cr, uid, cases, 'Open', history=True) - self.mail_user(cr,uid,ids) - return True - def button_reg_close(self, cr, uid, ids, *args): self.write(cr, uid, ids, {'state':'done',}) cases = self.browse(cr, uid, ids) @@ -223,7 +216,7 @@ class event_registration(osv.osv): "badge_name":fields.char('Badge Name',size=128), "badge_partner":fields.char('Badge Partner',size=128), "invoice_label":fields.char("Label Invoice",size=128,required=True), - "tobe_invoiced":fields.boolean("To be Invoice"), + "tobe_invoiced":fields.boolean("To be Invoiced"), "invoice_id":fields.many2one("account.invoice","Invoice"), } _defaults = { diff --git a/addons/event/event_view.xml b/addons/event/event_view.xml index 081462b2675..f4f02d34b66 100644 --- a/addons/event/event_view.xml +++ b/addons/event/event_view.xml @@ -198,7 +198,7 @@
- + @@ -220,7 +220,7 @@