1
1
# -*- coding: utf-8 -*-
2
- # © 2013-2015 Akretion - Alexis de Lattre <[email protected] >
2
+ # © 2013-2016 Akretion - Alexis de Lattre <[email protected] >
3
3
# © 2013 Noviat (http://www.noviat.com) - Luc de Meyer
4
4
# © 2014 Serv. Tecnol. Avanzados - Pedro M. Baeza
5
5
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
6
6
7
- from openerp import models , fields , api
7
+ from odoo import models , fields , api
8
8
import logging
9
9
10
10
logger = logging .getLogger (__name__ )
@@ -22,32 +22,31 @@ class ResCompany(models.Model):
22
22
help = "This will be used as the 'Initiating Party Identifier' in "
23
23
"the PAIN files generated by Odoo." )
24
24
25
- @api .model
26
- def _default_initiating_party (self , company ):
27
- '''This method is called from post_install.py, which itself is also
28
- called from migrations/8.0.0.2/post-migration.py'''
25
+ @api .one
26
+ def _default_initiating_party (self ):
27
+ '''This method is called from post_install.py'''
29
28
party_issuer_per_country = {
30
29
'BE' : 'KBO-BCE' , # KBO-BCE = the registry of companies in Belgium
31
30
}
32
31
logger .debug (
33
- 'Calling _default_initiating_party on company %s' , company .name )
34
- country_code = company .country_id .code
35
- if not company .initiating_party_issuer :
32
+ 'Calling _default_initiating_party on company %s' , self .name )
33
+ country_code = self .country_id .code
34
+ if not self .initiating_party_issuer :
36
35
if country_code and country_code in party_issuer_per_country :
37
- company .write ({
36
+ self .write ({
38
37
'initiating_party_issuer' :
39
38
party_issuer_per_country [country_code ]})
40
39
logger .info (
41
40
'Updated initiating_party_issuer on company %s' ,
42
- company .name )
41
+ self .name )
43
42
party_identifier = False
44
- if not company .initiating_party_identifier :
45
- if company .vat and country_code :
43
+ if not self .initiating_party_identifier :
44
+ if self .vat and country_code :
46
45
if country_code == 'BE' :
47
- party_identifier = company .vat [2 :].replace (' ' , '' )
46
+ party_identifier = self .vat [2 :].replace (' ' , '' )
48
47
if party_identifier :
49
- company .write ({
48
+ self .write ({
50
49
'initiating_party_identifier' : party_identifier })
51
50
logger .info (
52
51
'Updated initiating_party_identifier on company %s' ,
53
- company .name )
52
+ self .name )
0 commit comments