@@ -89,7 +89,7 @@ def parse_xml_invoice(self, xml_root):
89
89
90
90
@api .model
91
91
def select_taxes_of_invoice_line (
92
- self , taxes_xpath , namespaces , zug2odoo_tax , line_name = False ):
92
+ self , taxes_xpath , namespaces , unece2odoo_tax , line_name = False ):
93
93
'''This method is designed to be inherited'''
94
94
tax_ids = []
95
95
prec = self .env ['decimal.precision' ].precision_get ('Account' )
@@ -105,13 +105,16 @@ def select_taxes_of_invoice_line(
105
105
percent = percent_xpath [0 ].text and float (percent_xpath [0 ].text )\
106
106
or 0.0
107
107
odoo_tax_found = False
108
- for otax in zug2odoo_tax :
108
+ logger .debug (
109
+ 'select_taxes_of_invoice_line type_code=%s '
110
+ 'categ_code=%s percent=%s' , type_code , categ_code , percent )
111
+ for otax in unece2odoo_tax :
109
112
if (
110
- otax ['zugferd_type_code ' ] == type_code and
113
+ otax ['unece_type_code ' ] == type_code and
111
114
otax ['type' ] == 'percent' and
112
115
not float_compare (
113
116
percent , otax ['amount' ], precision_digits = prec )):
114
- if categ_code and categ_code != otax ['zugferd_categ_code ' ]:
117
+ if categ_code and categ_code != otax ['unece_categ_code ' ]:
115
118
continue
116
119
tax_ids .append (otax ['id' ])
117
120
odoo_tax_found = True
@@ -237,34 +240,34 @@ def parse_zugferd_xml(self, xml_root):
237
240
"//ram:SpecifiedTradeSettlementPaymentMeans"
238
241
"/ram:PayeeSpecifiedCreditorFinancialInstitution"
239
242
"/ram:BICID" , namespaces = namespaces )
240
- uoms = self .env ['product.uom' ].search ([('zugferd_code ' , '!=' , False )])
241
- zug2odoo_uom = {}
243
+ uoms = self .env ['product.uom' ].search ([('unece_code ' , '!=' , False )])
244
+ unece2odoo_uom = {}
242
245
for uom in uoms :
243
- zug2odoo_uom [uom .zugferd_code ] = uom .id
244
- logger .debug ('zug2odoo_uom = %s' , zug2odoo_uom )
246
+ unece2odoo_uom [uom .unece_code ] = uom .id
247
+ logger .debug ('unece2odoo_uom = %s' , unece2odoo_uom )
245
248
taxes = self .env ['account.tax' ].search ([
246
- ('zugferd_type_code ' , '!=' , False ),
247
- ('zugferd_categ_code ' , '!=' , False ),
249
+ ('unece_type_id ' , '!=' , False ),
250
+ ('unece_categ_id ' , '!=' , False ),
248
251
('type_tax_use' , 'in' , ('all' , 'purchase' )),
249
252
('price_include' , '=' , False ), # TODO : check what the standard
250
253
]) # says about this
251
- zug2odoo_tax = []
254
+ unece2odoo_tax = []
252
255
for tax in taxes :
253
- zug2odoo_tax .append ({
254
- 'zugferd_type_code ' : tax .zugferd_type_code ,
255
- 'zugferd_categ_code ' : tax .zugferd_categ_code ,
256
+ unece2odoo_tax .append ({
257
+ 'unece_type_code ' : tax .unece_type_code ,
258
+ 'unece_categ_code ' : tax .unece_categ_code ,
256
259
'type' : tax .type ,
257
260
'amount' : tax .amount * 100 ,
258
261
'id' : tax .id ,
259
262
})
260
- logger .debug ('zug2odoo_tax =%s' , zug2odoo_tax )
263
+ logger .debug ('unece2odoo_tax =%s' , unece2odoo_tax )
261
264
# global_tax_ids only used as fallback when taxes are not detailed
262
265
# on invoice lines (which is the case at Basic level)
263
266
global_taxes_xpath = xml_root .xpath (
264
267
"//ram:ApplicableSupplyChainTradeSettlement"
265
268
"/ram:ApplicableTradeTax" , namespaces = namespaces )
266
269
global_tax_ids = self .select_taxes_of_invoice_line (
267
- global_taxes_xpath , namespaces , zug2odoo_tax )
270
+ global_taxes_xpath , namespaces , unece2odoo_tax )
268
271
logger .debug ('global_tax_ids=%s' , global_tax_ids )
269
272
res_lines = []
270
273
total_line_lines = 0.0
@@ -284,8 +287,8 @@ def parse_zugferd_xml(self, xml_root):
284
287
qty = float (qty_xpath [0 ].text )
285
288
uos_id = False
286
289
if qty_xpath [0 ].attrib and qty_xpath [0 ].attrib .get ('unitCode' ):
287
- zug_uom = qty_xpath [0 ].attrib ['unitCode' ]
288
- uos_id = zug2odoo_uom .get (zug_uom )
290
+ unece_uom = qty_xpath [0 ].attrib ['unitCode' ]
291
+ uos_id = unece2odoo_uom .get (unece_uom )
289
292
ean13_xpath = iline .xpath (
290
293
"ram:SpecifiedTradeProduct/ram:GlobalID" ,
291
294
namespaces = namespaces )
@@ -314,7 +317,7 @@ def parse_zugferd_xml(self, xml_root):
314
317
"ram:SpecifiedSupplyChainTradeSettlement"
315
318
"//ram:ApplicableTradeTax" , namespaces = namespaces )
316
319
tax_ids = self .select_taxes_of_invoice_line (
317
- taxes_xpath , namespaces , zug2odoo_tax , name )
320
+ taxes_xpath , namespaces , unece2odoo_tax , name )
318
321
vals = {
319
322
'ean13' : ean13_xpath and ean13_xpath [0 ].text or False ,
320
323
'product_code' :
@@ -350,7 +353,7 @@ def parse_zugferd_xml(self, xml_root):
350
353
taxes_xpath = chline .xpath (
351
354
"ram:AppliedTradeTax" , namespaces = namespaces )
352
355
tax_ids = self .select_taxes_of_invoice_line (
353
- taxes_xpath , namespaces , zug2odoo_tax , name )
356
+ taxes_xpath , namespaces , unece2odoo_tax , name )
354
357
vals = {
355
358
'name' : name ,
356
359
'quantity' : 1 ,
@@ -396,7 +399,7 @@ def parse_zugferd_xml(self, xml_root):
396
399
taxes_xpath = alline .xpath (
397
400
"ram:CategoryTradeTax" , namespaces = namespaces )
398
401
tax_ids = self .select_taxes_of_invoice_line (
399
- taxes_xpath , namespaces , zug2odoo_tax , name )
402
+ taxes_xpath , namespaces , unece2odoo_tax , name )
400
403
vals = {
401
404
'name' : name ,
402
405
'quantity' : tradeallowance_qty ,
0 commit comments