~vauxoo/openerp-venezuela-localization/ovl70-rev-modulesdoc-yani

« back to all changes in this revision

Viewing changes to l10n_ve_withholding_islr/model/islr_xml_wh.py

  • Committer: Yanina Aular
  • Date: 2013-04-10 21:09:41 UTC
  • Revision ID: yanina.aular@vauxoo.com-20130410210941-fdazibceazadjvoh

[ADD] more documentation

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
    _description = 'Generate XML'
42
42
 
43
43
    def _get_amount_total(self,cr,uid,ids,name,args,context=None):
44
 
        '''
45
 
        Returns withhold total amount
46
 
        '''
 
44
        """ Returns withhold total amount
 
45
        """
47
46
        res = {}
48
47
        for xml in self.browse(cr,uid,ids,context):
49
48
            res[xml.id]= 0.0
52
51
        return res
53
52
 
54
53
    def _get_amount_total_base(self,cr,uid,ids,name,args,context=None):
55
 
        '''
56
 
        Returns base total amount
57
 
        '''
 
54
        """ Returns base total amount
 
55
        """
58
56
        res = {}
59
57
        for xml in self.browse(cr,uid,ids,context):
60
58
            res[xml.id]= 0.0
89
87
    }
90
88
 
91
89
    def period_return(self,cr,uid,context=None):
92
 
        '''
93
 
        Returns current period
94
 
        '''
 
90
        """ Returns current period
 
91
        """
95
92
        period_obj = self.pool.get('account.period')
96
93
        fecha = time.strftime('%m/%Y')
97
94
        period_id = period_obj.search(cr,uid,[('code','=',fecha)])
101
98
            return False
102
99
 
103
100
    def search_period(self,cr,uid,ids,period_id,context=None):
104
 
        '''
105
 
        Returns islr lines associated with the period_id
 
101
        """ Returns islr lines associated with the period_id
106
102
        @param period_id: period associated with returned islr lines
107
 
        '''
 
103
        """
108
104
        if context is None:
109
105
            context = {}
110
106
        res ={'value':{}}
116
112
                return res
117
113
                
118
114
    def name_get(self, cr, uid, ids, context={}):
119
 
        '''
120
 
        Returns id and name of all records
121
 
        '''
 
115
        """ Returns id and name of all records
 
116
        """
122
117
        if not len(ids):
123
118
            return []
124
119
        
126
121
        return res
127
122
 
128
123
    def action_anular1(self, cr, uid, ids, context={}):
129
 
        '''
130
 
        Returns the document to draft status
131
 
        '''
 
124
        """ Returns the document to draft status
 
125
        """
132
126
        return self.write(cr, uid, ids, {'state':'draft'})
133
127
 
134
128
    def action_confirm1(self, cr, uid, ids, context={}):
135
 
        '''
136
 
        Passes the document to state confirmed
137
 
        '''
 
129
        """ Passes the document to state confirmed
 
130
        """
138
131
        return self.write(cr, uid, ids, {'state':'confirmed'})
139
132
 
140
133
    def action_done1(self, cr, uid, ids, context={}):
141
 
        '''
142
 
        Passes the document to state done
143
 
        '''
 
134
        """ Passes the document to state done
 
135
        """
144
136
        root = self._xml(cr,uid,ids)
145
137
        self._write_attachment(cr,uid,ids,root,context)
146
138
        self.write(cr, uid, ids, {'state':'done'})
147
139
        return True
148
140
 
149
141
    def _write_attachment(self, cr,uid,ids,root,context):
150
 
        '''
151
 
        Codify the xml, to save it in the database and be able to 
 
142
        """ Codify the xml, to save it in the database and be able to 
152
143
        see it in the client as an attachment
153
144
        @param root: data of the document in xml
154
 
        '''
 
145
        """
155
146
        fecha = time.strftime('%Y_%m_%d_%H%M%S')
156
147
        name = 'ISLR_' + fecha +'.'+ 'xml'
157
148
        self.pool.get('ir.attachment').create(cr, uid, {
166
157
        self.log(cr, uid, ids[0], _("File XML %s generated.") % name)
167
158
 
168
159
    def indent(self,elem, level=0):
169
 
        '''
170
 
        Return indented text
 
160
        """ Return indented text
171
161
        @param level: number of spaces for indentation
172
162
        @param elem: text to indentig
173
 
        '''
 
163
        """
174
164
        i = "\n" + level*"  "
175
165
        if len(elem):
176
166
            if not elem.text or not elem.text.strip():
187
177
 
188
178
 
189
179
    def _xml(self, cr,uid,ids):
190
 
        '''
191
 
        Transforms this document to XML format
192
 
        '''
 
180
        """ Transforms this document to XML format
 
181
        """
193
182
        root = ''
194
183
        for id in ids:
195
184
            wh_brw = self.browse(cr,uid,id)
254
243
    }
255
244
 
256
245
    def onchange_partner_vat(self, cr, uid, ids, partner_id, context={}):
257
 
        '''
258
 
        Changing the partner, the partner_vat field is updated.
259
 
        '''
 
246
        """ Changing the partner, the partner_vat field is updated.
 
247
        """
260
248
        partner_brw = self.pool.get('res.partner').browse(cr,uid,partner_id)
261
249
        return {'value' : {'partner_vat':partner_brw.vat[2:]}} 
262
250
        
263
251
        
264
252
    def onchange_code_perc(self, cr, uid, ids, rate_id, context={}):
265
 
        '''
266
 
        Changing the rate of the islr, the porcent_rete and concept_code fields
 
253
        """ Changing the rate of the islr, the porcent_rete and concept_code fields
267
254
        is updated.
268
 
        '''
 
255
        """
269
256
        rate_brw = self.pool.get('islr.rates').browse(cr,uid,rate_id)
270
257
        return {'value' : {'porcent_rete':rate_brw.wh_perc,'concept_code':rate_brw.code}} 
271
258