From a769ffed80b1bc8bc8192e456eef6b4859795fd0 Mon Sep 17 00:00:00 2001 From: Gabriel Davini <gabrielfranciscodavini@gmail.com> Date: Thu, 19 Apr 2018 20:16:05 -0300 Subject: [PATCH] [REM] Remove final consumer stuff because it's now part of l10n_ar_point_of_sale --- __openerp__.py | 4 +-- delivery_cot.py | 75 ++++++++++++++++++++----------------------- delivery_cot_view.xml | 23 ++++--------- 3 files changed, 42 insertions(+), 60 deletions(-) diff --git a/__openerp__.py b/__openerp__.py index 070cad3..dd8a333 100644 --- a/__openerp__.py +++ b/__openerp__.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ############################################################################## -# +# # Copyright (C) 2015 Eynes - Ingenieria del software (www.eynes.com.ar) # # This program is free software: you can redistribute it and/or modify @@ -27,7 +27,7 @@ 'author': 'Eynes - Ingenieria del software', 'website': 'http://www.eynes.com.ar', 'license': 'AGPL-3', - "depends" : ['sale_stock', 'l10n_ar_stock_picking_number'], + "depends" : ['sale_stock', 'l10n_ar_stock_picking_number', 'l10n_ar_point_of_sale'], "data" : [ 'delivery_cot_view.xml', 'new_stock_config_view.xml', diff --git a/delivery_cot.py b/delivery_cot.py index 152526c..ed42945 100644 --- a/delivery_cot.py +++ b/delivery_cot.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ############################################################################## -# +# # Copyright (C) 2015 Eynes - Ingenieria del software (www.eynes.com.ar) # # This program is free software: you can redistribute it and/or modify @@ -28,13 +28,6 @@ from lib import cot import re -class invoice_fiscal_position(osv.osv): - _inherit = 'account.fiscal.position' - _columns = { - 'is_final_consumer' : fields.boolean('Is final consumer') - } -invoice_fiscal_position() - class res_country_state(osv.osv): _inherit = 'res.country.state' _columns = { @@ -56,7 +49,7 @@ class product_template(osv.osv): 'cot_nomenclature_id' : fields.many2one('product.cot.nomenclature','COT nomenclature') } product_template() - + class res_partner(osv.osv): _inherit = 'res.partner' _columns = { @@ -85,7 +78,7 @@ class res_partner(osv.osv): if address.num: num = _('Num: ') + address.num - if door or floor or num: + if door or floor or num: location = num + door + floor + '\n' word = res.splitlines(1) word.insert(1,location) @@ -93,7 +86,7 @@ class res_partner(osv.osv): return res res_partner() - + class stock_picking(osv.osv): _inherit = "stock.picking" @@ -119,10 +112,10 @@ class stock_picking(osv.osv): value['license_plate_id'] = c_license_id value['trailer_license_plate_id'] = t_license_id - + res['value'] = value return res - + def _get_packages(self, cr, uid, ids, context=None): if context is None: context = {} @@ -140,7 +133,7 @@ class stock_picking(osv.osv): packaging = product_packaging_obj.browse(cr, uid, packaging_ids[0], context) aux = move.product_qty / packaging.qty qty += aux - + return qty @@ -152,7 +145,7 @@ class stock_picking(osv.osv): if pick.declared_value: qty = pick.declared_value continue - + if pick.sale_id: order = pick.sale_id elif pick.purchase_id: @@ -179,7 +172,7 @@ class stock_picking(osv.osv): if qty !=0: if pick.company_id.currency_id.id != (order.currency_id.id): currency_obj = self.pool.get('res.currency') - from_currency = order.currency_id.id + from_currency = order.currency_id.id to_currency = pick.company_id.currency_id.id qty = currency_obj.compute(cr, uid, from_currency, to_currency, qty) return qty @@ -226,8 +219,8 @@ class stock_picking(osv.osv): return cuit.group(0) else: raise osv.except_osv(('COT Error'), _("%s: CUIT is invalid" ) %(company.name)) - - def get_sequence(self, cr, uid, address, context=None): + + def get_sequence(self, cr, uid, address, context=None): sequence = re.search("(\d{4})-(\d{8})", address.name) if sequence: return "91 R"+ sequence.group(1) + sequence.group(2) @@ -240,7 +233,7 @@ class stock_picking(osv.osv): now_date = self.get_Datetime(cr, uid,now_date_gmt.strftime("%Y-%m-%d %H:%M:%S"), context=context) day_max_gmt = (now_date_gmt + datetime.timedelta(days=30)).strftime("%Y-%m-%d %H:%M:%S") day_max = self.get_Datetime(cr, uid, day_max_gmt, context=context) - + if date_transport >= now_date: if date_transport <= day_max: return date_transport @@ -250,7 +243,7 @@ class stock_picking(osv.osv): return False def get_Datetime(self, cr, uid, data, context=None): - #from_string + #from_string date = datetime.datetime.strptime(data,"%Y-%m-%d %H:%M:%S") t_tz = fields.datetime.context_timestamp(cr,uid,date,context=context) return t_tz @@ -266,7 +259,7 @@ class stock_picking(osv.osv): is_final_consumer = int(express_id.property_account_position.is_final_consumer or False) carrier_cuit = self.get_cuit(cr, uid, address, address.carrier_id, context=context) - + type_path = 'U' refund = int(self.is_refund(address)) @@ -298,14 +291,14 @@ class stock_picking(osv.osv): company_cod_state = address.company_id.state_id.COT_code company_zip = address.company_id.zip company_city = address.company_id.city - company_street = address.company_id.street - company_reason_social = address.company_id.name + company_street = address.company_id.street + company_reason_social = address.company_id.name company_floor = address.company_id.floor or '' company_departament = address.company_id.departament or '' company_number = address.company_id.num or '' company_state_valid = address.company_id.state_id.COT_valid - location = address.location_id.usage + location = address.location_id.usage location_dest = address.location_dest_id.usage unique_code = self.get_sequence(cr, uid, address, context=context) @@ -413,7 +406,7 @@ class stock_picking(osv.osv): '|' + partner_reason_social + '|' + str(tenedor) + '|' + partner_street + '|' + partner_number +'|'+ partner_comple +'|' + partner_floor + \ '|'+ partner_departament + '| |' + partner_zip + \ '|' + partner_city + '|' + partner_cod_state + '|' + carrier_cuit + '|' + type_path + \ - '| | | |' + license_plate + '|' + trailer_license_plate +'|' + str(refund) + '|' + str(import_value) + '\n' + '| | | |' + license_plate + '|' + trailer_license_plate +'|' + str(refund) + '|' + str(import_value) + '\n' else: subject = 'E' #Soy el proveedor @@ -424,7 +417,7 @@ class stock_picking(osv.osv): dest_tenedor = 0 tenedor = 0 - + remit = '02|' + date + '|' + unique_code + '|' + date_transport + '|' + time_transport + '|' + subject + \ '|' + str(is_final_consumer) + '| | |' + partner_cuit + '|' + partner_reason_social + \ '|' + str(dest_tenedor) + '|' + partner_street + '|' + partner_number +'|'+ partner_comple +'|' + partner_floor +'|' + partner_departament + '| |' + partner_zip + \ @@ -432,7 +425,7 @@ class stock_picking(osv.osv): '|' + company_reason_social + '|' + str(tenedor) + '|' + company_street + '|'+ company_number + '|'+ company_comple +'|' + company_floor + \ '|' + company_departament +'| |' + company_zip + \ '|' + company_city + '|' + company_cod_state + '|' + carrier_cuit + '|' + type_path + \ - '| | | |' + license_plate + '|' + trailer_license_plate +'|' + str(refund) + '|' + str(import_value) + '\n' + '| | | |' + license_plate + '|' + trailer_license_plate +'|' + str(refund) + '|' + str(import_value) + '\n' return remit @@ -448,7 +441,7 @@ class stock_picking(osv.osv): product_nomenclature = line.product_id.cot_nomenclature_id.code if product_desc: - product_desc = line.name.replace('\n','')[:40] + product_desc = line.name.replace('\n','')[:40] else: raise osv.except_osv(('COT Error!'), _("%s, product desc is null" ) %(product_desc)) @@ -461,11 +454,11 @@ class stock_picking(osv.osv): if not product_uom_code: raise osv.except_osv(('COT Error!'), _("%s: COT uom is null" ) %(product_desc)) - ls_product.append('03|' + product_nomenclature + '|' + product_uom_code + '|' + product_qty + ls_product.append('03|' + product_nomenclature + '|' + product_uom_code + '|' + product_qty + '|' + product_code + '|' + product_desc + '|' + product_uom_categ + '|' + product_qty + '\n') return ls_product - + def do_cot_file(self, cr, uid, ids, context=None): for pick in self.browse(cr,uid,ids,context=context): @@ -476,7 +469,7 @@ class stock_picking(osv.osv): secuency = self.get_sequence(cr, uid, pick, context=None)[-6:] #URL = "http://cot.test.arba.gov.ar/TransporteBienes/SeguridadCliente/presentarRemitos.do" # testing URL = self._get_cot_url(cr, uid, context=context) - + #file name fileName = 'TB_' + cuit + '_' + floor.zfill(3) + door.zfill(3) + '_' + date + '_' + secuency + '.txt' @@ -527,7 +520,7 @@ class stock_picking(osv.osv): else: raise osv.except_osv(('COT Error!'), _("Error %s Type: %s \n %s" ) %(cot_obj.CodigoError, cot_obj.TipoError, cot_obj.MensajeError)) - + return True def _get_cot_pass(self,cr, uid, context=None): @@ -537,7 +530,7 @@ class stock_picking(osv.osv): return cot_pass def _get_cot_url(self,cr, uid, context=None): - # Obtenemos la url para enviar el remito + # Obtenemos la url para enviar el remito config_obj = self.pool.get("ir.config_parameter") cot_url = config_obj.get_param(cr, uid, "cot_url", default="http://arba.gov.ar/", context=context) return cot_url @@ -596,9 +589,9 @@ class stock_picking_out(osv.osv): 'weight' : fields.float('Weight') } -stock_picking_out() - - +stock_picking_out() + + class stock_picking_in(osv.osv): _inherit = "stock.picking.in" _table = "stock_picking" @@ -634,7 +627,7 @@ class stock_picking_in(osv.osv): 'weight' : fields.float('Weight') } -stock_picking_in() +stock_picking_in() class sale_order(osv.osv): @@ -654,7 +647,7 @@ class sale_order(osv.osv): c_license_ids = order.carrier_id.license_plate_ids t_license_ids = order.carrier_id.trailer_license_plate_ids - + if c_license_ids: c_license_id = c_license_ids[0].id else: @@ -726,7 +719,7 @@ class new_stock_setting(osv.osv_memory): def get_default_cot_url(self, cr,uid, fields,context=None): value = self.pool.get('ir.config_parameter').get_param(cr, uid, 'cot_url', default="http://arba.gov.ar/") return {'cot_url': value} - + def set_cot_pass(self, cr, uid, ids, context=None, *args, **kwargs): stock_config_id = self.browse(cr, uid, ids, context=context)[0] cot_pass = stock_config_id.cot_pass @@ -739,11 +732,11 @@ class new_stock_setting(osv.osv_memory): config_param_model = self.pool.get('ir.config_parameter') config_param_model.set_param(cr, uid, "cot_url", cot_url) - + _columns ={ 'cot_pass' : fields.char("Cot Password", help="COT password"), 'cot_url': fields.char("Cot url", help="Insert url for upload electronic remit"), - 'group_check_cot' : fields.boolean('Eneable web service', + 'group_check_cot' : fields.boolean('Eneable web service', implied_group='delivery_cot.group_check_cot') } new_stock_setting() diff --git a/delivery_cot_view.xml b/delivery_cot_view.xml index 8068a70..ca9e4e1 100644 --- a/delivery_cot_view.xml +++ b/delivery_cot_view.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <openerp> <data> - + <record id="view_product_product_form1" model="ir.ui.view"> <field name="name">product.product.form1</field> <field name="model">product.product</field> @@ -36,17 +36,6 @@ </field> </record> - <record id="view_account_position_form1" model="ir.ui.view"> - <field name="name">account.position.form1</field> - <field name="model">account.fiscal.position</field> - <field name="inherit_id" ref="account.view_account_position_form"></field> - <field name="arch" type="xml"> - <field name="active" position="after"> - <field name="is_final_consumer"/> - </field> - </field> - </record> - <record id="view_picking_out_form1" model="ir.ui.view"> <field name="name">stock.picking.out.form1</field> <field name="model">stock.picking.out</field> @@ -92,7 +81,7 @@ </field> </field> </record> - + <record id="view_picking_in_form1" model="ir.ui.view"> <field name="name">stock.picking.in.form1</field> <field name="model">stock.picking.in</field> @@ -103,7 +92,7 @@ </field> </field> </record> - <!-- SOLO PARA TRANSFERENCIAS DE SALIDA + <!-- SOLO PARA TRANSFERENCIAS DE SALIDA <record id="view_picking_in_form1" model="ir.ui.view"> <field name="name">stock.picking.in.form1</field> <field name="model">stock.picking.in</field> @@ -181,7 +170,7 @@ </field> </field> </record> - + <record id="view_order_sale_form" model="ir.ui.view"> <field name="name">sale.order.form.view</field> <field name="model">sale.order</field> @@ -216,8 +205,8 @@ </tree> </field> </record> - - <act_window + + <act_window name="Cot nomenclature" id="action_cot_nomeclature" res_model="product.cot.nomenclature" -- GitLab