예제 #1
0
파일: product.py 프로젝트: newmooncn/actin
	def _get_rubylong_xml(self, cr, uid, ids, field_names, args, context=None):
		if isinstance(ids, (int, long)):
			ids = [ids]
		res = {}
		for po_id in ids:
			res[po_id] = ''
		data_xml = ''
		order_main = None
		orders = self.browse(cr, uid, ids, context=context)
		for order in orders:
			if not order_main:
				order_main = order
			#base data
			order_fields = self.rbfields_base
			data_xml += get_rubylong_fields_xml(order, 'header', order_fields)
		
		#write data
		if order_main:
			res[order_main.id] = get_rublong_data_url(order_main,data_xml,cr.dbname)
		return res
예제 #2
0
파일: product.py 프로젝트: newmooncn/actin
    def _get_rubylong_xml(self, cr, uid, ids, field_names, args, context=None):
        if isinstance(ids, (int, long)):
            ids = [ids]
        res = {}
        for po_id in ids:
            res[po_id] = ''
        data_xml = ''
        order_main = None
        orders = self.browse(cr, uid, ids, context=context)
        for order in orders:
            if not order_main:
                order_main = order
            #base data
            order_fields = self.rbfields_base
            data_xml += get_rubylong_fields_xml(order, 'header', order_fields)

        #write data
        if order_main:
            res[order_main.id] = get_rublong_data_url(order_main, data_xml,
                                                      cr.dbname)
        return res
예제 #3
0
 def _get_rubylong_xml(self, cr, uid, ids, field_names, args, context=None):
     if isinstance(ids, (int, long)):
         ids = [ids]
     res = {}
     for po_id in ids:
         res[po_id] = ''
     data_xml = ''
     order_main = None
     orders = self.browse(cr, uid, ids, context=context)
     for order in orders:
         if not order_main:
             order_main = order
         order_xml = ''
         #product data
         order_fields = [
                     ('id','product_id'),
                     'company_id.name',
                     'company_id.street',
                     'company_id.street2',
                     'company_id.city',
                     'company_id.country_id.name',
                     'company_id.contact',
                     'company_id.phone',
                     'company_id.fax',
                     'company_id.email',
                     ('company_id.logo','company_logo'),
                     
                     ('name','',upper),
                     ('default_code','code'),
                     'image',
                     'description',
                     
                     'tech_data',
                     
                     'certificate',
                     'labor',
                     
                     'dimension',
                     ('weight_char','weight_gross'),
                     ('weight_net_char','weight_net'),
                     'pack_out_dimension',
                     'pack_out_volume',
                     ('pack_out_gw','pack_out_weight_gross'),
                     
                     'qty_20gp',
                     'qty_40gp',
                     'qty_40hq',
                     'qty_pallet_eur',
                     'qty_pallet_us',
                     
                     'quote_validity',
                     'additional_comments',
                     
                     'moq',
                     ('uom_id.name','uom_name'),
                     
                     {'qty_20gp_print': order.product_id.qty_20gp > 0 and '%s %s'%(order.product_id.qty_20gp, order.product_id.uom_id.name) or ''},
                     {'qty_40gp_print': order.product_id.qty_40gp > 0 and '%s %s'%(order.product_id.qty_40gp, order.product_id.uom_id.name) or ''},
                     {'qty_40hq_print': order.product_id.qty_40hq > 0 and '%s %s'%(order.product_id.qty_40hq, order.product_id.uom_id.name) or ''},
                     {'qty_pallet_eur_print': order.product_id.qty_pallet_eur > 0 and '%s %s'%(order.product_id.qty_pallet_eur, order.product_id.uom_id.name) or ''},
                     {'qty_pallet_us_print': order.product_id.qty_pallet_us > 0 and '%s %s'%(order.product_id.qty_pallet_us, order.product_id.uom_id.name) or ''}                        
                                   
                     ]
                   
         order_xml += get_rubylong_fields_xml_body(order.product_id, order_fields)
         
         #customer data
         order_fields = [
                     ('prod_cust_id.name.name','partner_name'),
                     ('pr_number','order_name'),
                     'date_order',
                     ('prod_cust_id.name.contact','partner_contact'),
                     
                     ('prod_cust_id.price', 'price_unit'),
                     ('prod_cust_id.curr_name', 'currency_name'),
                     ('prod_cust_id.curr_name', 'currency_symbol'),
                     ('prod_cust_id.incoterm.name', 'incoterm'),
                     ('prod_cust_id.payment_term_id.name', 'payment_term'),
                     ('prod_cust_id.port_discharge.name', 'port'),
                     ('prod_cust_id.delay', 'lead_time'),                        
                     ]
         order_xml += get_rubylong_fields_xml_body(order, order_fields)
         
         #final xml for this order
         data_xml = "<%s>%s</%s>"%('header', order_xml, 'header')            
     
     #write data
     if order_main:
         res[order_main.id] = get_rublong_data_url(order_main,data_xml,cr.dbname)
     return res
예제 #4
0
    def _get_rubylong_xml(self, cr, uid, ids, field_names, args, context=None):
        if isinstance(ids, (int, long)):
            ids = [ids]
        res = {}
        for po_id in ids:
            res[po_id] = ''
        data_xml = ''
        orders = self.browse(cr, uid, ids, context=context)
        for order in orders:
            data_xml = ''
            #header data
            order_fields = [
                ('id', 'order_id'),
                'company_id.name',
                'company_id.street',
                'company_id.street2',
                'company_id.city',
                'company_id.zip',
                'company_id.country_id.name',
                'company_id.contact',
                'company_id.phone',
                'company_id.fax',
                'company_id.email',
                ('company_id.logo', 'company_logo'),
                ('partner_id.name', 'partner_invoice_id_name'),
                #('partner_id.name', 'partner_invoice_id_name_upper', upper),
                ('partner_id.street', 'partner_invoice_id_street'),
                ('partner_id.street2', 'partner_invoice_id_street2'),
                ('partner_id.city', 'partner_invoice_id_city'),
                ('partner_id.zip', 'partner_invoice_id_zip'),
                ('partner_id.country_id.name',
                 'partner_invoice_id_country_id_name'),
                ('partner_id.phone', 'partner_invoice_id_phone'),
                ('partner_id.contact', 'partner_invoice_id_contact'),
                ('partner_id.email', 'partner_invoice_id_email'),
                ('number', 'name'),
                ('date_invoice', 'date_order'),
                ('port_load_id.name', '', upper),
                ('port_discharge_id.name', '', upper),
                'amount_total',
                ('amount_total', 'amount_total_en', number2words_en_upper2),
                'incoterm.name',
                'total_shipped',
                'contract_n',
                'bl_number',
                'container_no',
                'seal_no',
                'serial_no',
                'hs_code',
                ('currency_id.symbol', 'currency_symbol'),
                ('currency_id.name', 'currency_name'),
                'comment',
                'addion_comment',

                #for service invoice
                ('parent_id.number', 'prod_inv_name'),
                #dm added
                ('company_id.img_stamp', 'company_stamp'),
                ('origin_inv_id.number', 'origin_inv_name')
            ]

            partner_invoice_id_name_upper = '%s - %s' % (
                order.partner_id.ref, upper(order.partner_id.name))
            order_fields_new = order_fields + [{
                'partner_invoice_id_name_upper':
                partner_invoice_id_name_upper
            }]
            order_xml = get_rubylong_fields_xml_body(order, order_fields_new)

            #partner shipping address
            sale_order = self.sale_order(cr, uid, order.id, context=context)
            if sale_order:
                order_fields = [
                    ('partner_shipping_id.name', 'partner_shipping_id_name'),
                    ('partner_shipping_id.name',
                     'partner_shipping_id_name_upper', upper),
                    ('partner_shipping_id.street',
                     'partner_shipping_id_street'),
                    ('partner_shipping_id.street2',
                     'partner_shipping_id_street2'),
                    ('partner_shipping_id.city', 'partner_shipping_id_city'),
                    ('partner_shipping_id.zip', 'partner_shipping_id_zip'),
                    ('partner_shipping_id.country_id.name',
                     'partner_shipping_id_country_id_name'),
                    ('partner_shipping_id.phone', 'partner_shipping_id_phone'),
                    ('partner_shipping_id.contact',
                     'partner_shipping_id_contact'),
                    ('partner_shipping_id.email', 'partner_shipping_id_email'),
                    ('client_order_ref', '', upper),
                ]
                order_xml += get_rubylong_fields_xml_body(
                    sale_order, order_fields)

            #add this order's xml
            data_xml = "<%s>%s</%s>" % ('header', order_xml, 'header')

            #detail data
            line_fields = [('invoice_id.id', 'order_id'),
                           ('id', 'order_line_id'),
                           ('quantity', 'product_qty'),
                           ('uos_id.name', 'product_uom_name'), 'price_unit',
                           'price_subtotal',
                           ('invoice_id.currency_id.symbol',
                            'currency_symbol')]

            for line in order.invoice_line:
                line_xml = get_rubylong_fields_xml_body(line, line_fields)
                #add item_no, item_name
                customer = order.partner_id.parent_id and order.partner_id.parent_id or order.partner_id
                prod_customer = self.pool.get(
                    'product.product').get_customer_product(cr,
                                                            uid,
                                                            customer.id,
                                                            line.product_id.id,
                                                            context=context)
                if prod_customer:
                    line_xml += get_rubylong_fields_xml_body(
                        prod_customer, [('product_code', 'item_no'),
                                        ('product_name', 'item_name')])
                #add full xml
                data_xml += "<%s>%s</%s>" % ('detail', line_xml, 'detail')

            #write data to file
            res[order.id] = get_rublong_data_url(order, data_xml, cr.dbname)

        return res
예제 #5
0
    def _rubylong_xml_file_dn(self,
                              cr,
                              uid,
                              ids,
                              field_names,
                              args,
                              context=None):
        if isinstance(ids, (int, long)):
            ids = [ids]
        res = {}
        for po_id in ids:
            res[po_id] = ''
        data_xml = ''
        orders = self.browse(cr, uid, ids, context=context)
        for order in orders:
            data_xml = ''
            #header data
            order_fields = [
                ('id', 'order_id'),
                'company_id.name',
                'company_id.street',
                'company_id.street2',
                'company_id.city',
                'company_id.zip',
                'company_id.country_id.name',
                'company_id.contact',
                'company_id.phone',
                'company_id.fax',
                'company_id.email',
                ('company_id.logo', 'company_logo'),
                'partner_id.name',
                #						('partner_id.name', 'partner_id_name_upper', upper),
                'partner_id.street',
                'partner_id.street2',
                'partner_id.city',
                'partner_id.zip',
                'partner_id.country_id.name',
                'partner_id.phone',
                'partner_id.contact',
                'partner_id.email',
                ('number', 'name'),
                ('date_invoice', 'date_order'),
                ('port_load_id.name', '', upper),
                ('port_discharge_id.name', '', upper),
                'amount_total',
                ('amount_total', 'amount_total_en', number2words_en_upper2),
                'incoterm.name',
                'total_shipped',
                'contract_n',
                'bl_number',
                'container_no',
                'seal_no',
                'serial_no',
                'hs_code',
                ('currency_id.symbol', 'currency_symbol'),
                ('currency_id.name', 'currency_name'),
                'comment',
                'addion_comment',

                #dm added
                ('company_id.img_stamp', 'company_stamp'),

                #user added
                'qty_carton_total',
                'weight_net_total',
                'weight_gross_total',
                ('m3_total', 'volume_total'),
                ('origin_inv_id.number', 'origin_inv_name')
            ]

            partner_id_name_upper = '%s - %s' % (order.partner_id.ref,
                                                 upper(order.partner_id.name))
            order_fields_new = order_fields + [{
                'partner_id_name_upper':
                partner_id_name_upper
            }]
            order_xml = get_rubylong_fields_xml_body(order, order_fields_new)

            #partner shipping address
            purchase_order = self.purchase_order(cr,
                                                 uid,
                                                 order.id,
                                                 context=context)
            if purchase_order:
                order_fields = [
                    ('name', 'po_name'),
                    ('client_order_ref', '', upper),
                    ('port_load_id.name', '', upper),
                    ('port_discharge_id.name', '', upper),
                ]
                order_xml += get_rubylong_fields_xml_body(
                    purchase_order, order_fields)

            #add this order's xml
            data_xml = "<%s>%s</%s>" % ('header', order_xml, 'header')

            #detail data
            line_fields = [
                ('invoice_id.id', 'order_id'), ('id', 'order_line_id'),
                ('product_id.seller_product_name', 'supplier_item_no'),
                ('product_id.description_purchase', 'supplier_item_name'),
                ('quantity', 'product_qty'),
                ('uos_id.name', 'product_uom_name'), 'price_unit',
                'price_subtotal',
                ('invoice_id.currency_id.symbol', 'currency_symbol')
            ]

            for line in order.invoice_line:
                data_xml += get_rubylong_fields_xml(line, 'detail',
                                                    line_fields)

            #write data to file
            res[order.id] = get_rublong_data_url(order, data_xml, cr.dbname)

        return res
예제 #6
0
	def _get_rubylong_xml(self, cr, uid, ids, field_names, args, context=None):
		if isinstance(ids, (int, long)):
			ids = [ids]
		res = {}
		for po_id in ids:
			res[po_id] = ''
		data_xml = ''
		order_main = None
		orders = self.browse(cr, uid, ids, context=context)
		for order in orders:
#			test = order.company_id.img_stamp.encode('base64')
			if not order_main:
				order_main = order
			#header data
			order_fields = [
						('id','order_id'),
						'company_id.name',
						'company_id.street',
						'company_id.street2',
						'company_id.city',
						'company_id.zip',
						'company_id.country_id.name',
						'company_id.contact',
						'company_id.phone',
						'company_id.fax',
						'company_id.email',
						('company_id.logo','company_logo'),
						
						'partner_id.name',
#						('partner_id.name', 'partner_id_name_upper', upper),
						'partner_id.street',
						'partner_id.street2',
						'partner_id.city',
						'partner_id.zip',
						'partner_id.country_id.name',
						'partner_id.phone',
						'partner_id.contact',
						'partner_id.email',
						
						'name',
						'date_order',
						
						('client_order_ref','', upper),
						('port_load_id.name','', upper),
						('port_discharge_id.name','', upper),
						
						'amount_total',
						('amount_total', 'amount_total_en', number2words_en_upper2),
						
						('deliver_memo','',upper),
						'incoterm_id.name',
						'payment_term_id.name',
						'ship_type.name',
						
						'certs',
						'qc_requirement',						
						'load_control',
						'penalties_on_delays',
						'discrepancy',
						'disputes',
						'doc_export',
						'confirmation',
						'artworks',
						'notes',
						
						('pricelist_id.currency_id.symbol','currency_symbol'),						
						('pricelist_id.currency_id.name','currency_name'),
						
						#dm added
						('company_id.img_stamp','company_stamp')
						
						]
			
			partner_id_name_upper = '%s - %s'%(order.partner_id.ref, upper(order.partner_id.name))
			order_fields_new = order_fields + [{'partner_id_name_upper':partner_id_name_upper}]
			data_xml += get_rubylong_fields_xml(order, 'header', order_fields_new)
			
		for order in orders:
			#detail data
			line_fields = [
						('order_id.id','order_id'),
						('id','order_line_id'),
						('supplier_prod_name','supplier_item_no'),
						('name','supplier_item_name'),
						'product_qty',
						'product_uom.name',
						'price_unit',
						'price_subtotal',
						('order_id.pricelist_id.currency_id.symbol','currency_symbol')
						]
			
			for line in order.order_line:
				data_xml += get_rubylong_fields_xml(line, 'detail', line_fields)
		
		#write data
		if order_main:
			res[order_main.id] = get_rublong_data_url(order_main,data_xml,cr.dbname)
		return res
예제 #7
0
    def _get_rubylong_xml(self, cr, uid, ids, field_names, args, context=None):
        if isinstance(ids, (int, long)):
            ids = [ids]
        res = {}
        for po_id in ids:
            res[po_id] = ''
        data_xml = ''
        order_main = None
        orders = self.browse(cr, uid, ids, context=context)
        for order in orders:
            order_xml = ''
            if not order_main:
                order_main = order
            order_fields = [
                ('id', 'product_id'),
                'company_id.name',
                'company_id.street',
                'company_id.street2',
                'company_id.city',
                'company_id.country_id.name',
                'company_id.contact',
                'company_id.phone',
                'company_id.fax',
                'company_id.email',
                ('company_id.logo', 'company_logo'),
                ('name', '', upper),
                ('default_code', 'code'),
                'image',
                'description',
                'tech_data',
                'certificate',
                'labor',
                'dimension',
                ('weight_char', 'weight_gross'),
                ('weight_net_char', 'weight_net'),
                'pack_out_dimension',
                'pack_out_volume',
                ('pack_out_gw', 'pack_out_weight_gross'),
                'qty_20gp',
                'qty_40gp',
                'qty_40hq',
                'qty_pallet_eur',
                'qty_pallet_us',
                'quote_validity',
                'additional_comments',

                #vendor data
                ('seller_id.name', 'partner_name'),
                ('seller_id.contact', 'partner_contact'),
                ('standard_price', 'price_unit'),

                #added by customer
                ('standard_price_curr_id.name', 'currency_name'),
                ('incoterm_id.name', 'incoterm'),
                (
                    'seller_payment_term_id.name',
                    'payment_term',
                ),
                'moq',
                ('seller_lead_time', 'lead_time'),
                ('uom_po_id.name', 'uom_name'),
                {
                    'qty_20gp_print':
                    order.product_id.qty_20gp > 0 and '%s %s' %
                    (order.product_id.qty_20gp, order.product_id.uom_id.name)
                    or ''
                },
                {
                    'qty_40gp_print':
                    order.product_id.qty_40gp > 0 and '%s %s' %
                    (order.product_id.qty_40gp, order.product_id.uom_id.name)
                    or ''
                },
                {
                    'qty_40hq_print':
                    order.product_id.qty_40hq > 0 and '%s %s' %
                    (order.product_id.qty_40hq, order.product_id.uom_id.name)
                    or ''
                },
                {
                    'qty_pallet_eur_print':
                    order.product_id.qty_pallet_eur > 0 and '%s %s' %
                    (order.product_id.qty_pallet_eur,
                     order.product_id.uom_id.name) or ''
                },
                {
                    'qty_pallet_us_print':
                    order.product_id.qty_pallet_us > 0 and '%s %s' %
                    (order.product_id.qty_pallet_us,
                     order.product_id.uom_id.name) or ''
                }
            ]
            order_xml += get_rubylong_fields_xml_body(order.product_id,
                                                      order_fields)

            #vendor data
            order_fields = [
                ('pr_number', 'order_name'),
                'date_order',
            ]
            order_xml += get_rubylong_fields_xml_body(order, order_fields)

            #currency
            order_fields = [
                ('name', 'currency_symbol'),
                ('name', 'currency_name'),
            ]
            currency = order.product_id.seller_id.property_product_pricelist_purchase.currency_id
            order_xml += get_rubylong_fields_xml_body(currency, order_fields)

            #port
            order_fields = [('port.name', 'port')]
            order_xml += get_rubylong_fields_xml_body(
                order.product_id.seller_id, order_fields)

            #final xml for this order
            data_xml = "<%s>%s</%s>" % ('header', order_xml, 'header')

        #write data
        if order_main:
            res[order_main.id] = get_rublong_data_url(order_main, data_xml,
                                                      cr.dbname)
        return res
예제 #8
0
	def _get_rubylong_xml(self, cr, uid, ids, field_names, args, context=None):
		if isinstance(ids, (int, long)):
			ids = [ids]
		res = {}
		for po_id in ids:
			res[po_id] = ''
		data_xml = ''
		order_main = None
		orders = self.browse(cr, uid, ids, context=context)
		for order in orders:
			if not order_main:
				order_main = order
			#header data
			order_fields = [
						('id','order_id'),
						'company_id.name',
						'company_id.street',
						'company_id.street2',
						'company_id.city',
						'company_id.zip',
						'company_id.country_id.name',
						'company_id.contact',
						'company_id.phone',
						'company_id.fax',
						'company_id.email',
						('company_id.logo','company_logo'),
						
						'partner_invoice_id.name',
						('partner_invoice_id.name', 'partner_invoice_id_name_upper', upper),
						'partner_invoice_id.street',
						'partner_invoice_id.street2',
						'partner_invoice_id.city',
						'partner_invoice_id.zip',
						'partner_invoice_id.country_id.name',
						'partner_invoice_id.phone',
						'partner_invoice_id.contact',
						'partner_invoice_id.email',
						
						'partner_shipping_id.name',
						'partner_shipping_id.street',
						'partner_shipping_id.street2',
						'partner_shipping_id.city',
						'partner_shipping_id.zip',
						'partner_shipping_id.country_id.name',
						'partner_shipping_id.phone',
						'partner_shipping_id.contact',
						'partner_shipping_id.email',
						
						'name',
						'date_order',
						
						('client_order_ref','', upper),
						('port_load_id.name','', upper),
						('port_discharge_id.name','', upper),
						
						'amount_total',
						('amount_total', 'amount_total_en', number2words_en_upper2),
						
						('deliver_memo','',upper),
						('incoterm.name', 'incoterm_id_name'),
						('payment_term.name','payment_term_id_name'),
						'ship_type.name',
						
						'terms_fix',
						'note',						
						
						'company_id.bank_id.bank_name',
						'company_id.bank_id.street',
						'company_id.bank_id.owner_name',
						'company_id.bank_id.bank_bic',
						'company_id.bank_id.acc_number',
						
						('pricelist_id.currency_id.symbol','currency_symbol'),						
						('pricelist_id.currency_id.name','currency_name'),
						
						#dm added
						('company_id.img_stamp','company_stamp'),
						
						#user added
						('company_id.bank_id.bank_swift','company_id_bank_id_bank_code')				
						
						]
			partner_name_upper = '%s - %s'%(order.partner_id.ref, upper(order.partner_id.name))
			order_fields_new = order_fields + [{'partner_name_upper':partner_name_upper}]
			data_xml += get_rubylong_fields_xml(order, 'header', order_fields_new)
			
		for order in orders:
			#detail data
			line_fields = [
						('order_id.id','order_id'),
						('id','order_line_id'),
						('cust_prod_code','item_no'),
						('name','item_name'),
						('product_uom_qty','product_qty'),
						'product_uom.name',
						'price_unit',
						'price_subtotal',
						('order_id.pricelist_id.currency_id.symbol','currency_symbol')
						]
			
			for line in order.order_line:
				data_xml += get_rubylong_fields_xml(line, 'detail', line_fields)
		
		#write data
		if order_main:
			res[order_main.id] = get_rublong_data_url(order_main,data_xml,cr.dbname)
		return res
예제 #9
0
    def _get_rubylong_xml(self, cr, uid, ids, field_names, args, context=None):
        if isinstance(ids, (int, long)):
            ids = [ids]
        res = {}
        for po_id in ids:
            res[po_id] = ''
        data_xml = ''
        order_main = None
        orders = self.browse(cr, uid, ids, context=context)
        for order in orders:
            #			test = order.company_id.img_stamp.encode('base64')
            if not order_main:
                order_main = order
            #header data
            order_fields = [
                ('id', 'order_id'),
                'company_id.name',
                'company_id.street',
                'company_id.street2',
                'company_id.city',
                'company_id.zip',
                'company_id.country_id.name',
                'company_id.contact',
                'company_id.phone',
                'company_id.fax',
                'company_id.email',
                ('company_id.logo', 'company_logo'),
                'partner_id.name',
                #						('partner_id.name', 'partner_id_name_upper', upper),
                'partner_id.street',
                'partner_id.street2',
                'partner_id.city',
                'partner_id.zip',
                'partner_id.country_id.name',
                'partner_id.phone',
                'partner_id.contact',
                'partner_id.email',
                'name',
                'date_order',
                ('client_order_ref', '', upper),
                ('port_load_id.name', '', upper),
                ('port_discharge_id.name', '', upper),
                'amount_total',
                ('amount_total', 'amount_total_en', number2words_en_upper2),
                ('deliver_memo', '', upper),
                'incoterm_id.name',
                'payment_term_id.name',
                'ship_type.name',
                'certs',
                'qc_requirement',
                'load_control',
                'penalties_on_delays',
                'discrepancy',
                'disputes',
                'doc_export',
                'confirmation',
                'artworks',
                'notes',
                ('pricelist_id.currency_id.symbol', 'currency_symbol'),
                ('pricelist_id.currency_id.name', 'currency_name'),

                #dm added
                ('company_id.img_stamp', 'company_stamp')
            ]

            partner_id_name_upper = '%s - %s' % (order.partner_id.ref,
                                                 upper(order.partner_id.name))
            order_fields_new = order_fields + [{
                'partner_id_name_upper':
                partner_id_name_upper
            }]
            data_xml += get_rubylong_fields_xml(order, 'header',
                                                order_fields_new)

        for order in orders:
            #detail data
            line_fields = [
                ('order_id.id', 'order_id'), ('id', 'order_line_id'),
                ('supplier_prod_name', 'supplier_item_no'),
                ('name', 'supplier_item_name'), 'product_qty',
                'product_uom.name', 'price_unit', 'price_subtotal',
                ('order_id.pricelist_id.currency_id.symbol', 'currency_symbol')
            ]

            for line in order.order_line:
                data_xml += get_rubylong_fields_xml(line, 'detail',
                                                    line_fields)

        #write data
        if order_main:
            res[order_main.id] = get_rublong_data_url(order_main, data_xml,
                                                      cr.dbname)
        return res
예제 #10
0
파일: invoice.py 프로젝트: newmooncn/actin
	def _get_rubylong_xml(self, cr, uid, ids, field_names, args, context=None):
		if isinstance(ids, (int, long)):
			ids = [ids]
		res = {}
		for po_id in ids:
			res[po_id] = ''
		data_xml = ''
		orders = self.browse(cr, uid, ids, context=context)
		for order in orders:
			data_xml = ''
			#header data
			order_fields = [
						('id','order_id'),
						'company_id.name',
						'company_id.street',
						'company_id.street2',
						'company_id.city',
						'company_id.zip',
						'company_id.country_id.name',
						'company_id.contact',
						'company_id.phone',
						'company_id.fax',
						'company_id.email',
						('company_id.logo','company_logo'),
						
						('partner_id.name','partner_invoice_id_name'),
						#('partner_id.name', 'partner_invoice_id_name_upper', upper),
						('partner_id.street','partner_invoice_id_street'),
						('partner_id.street2','partner_invoice_id_street2'),
						('partner_id.city','partner_invoice_id_city'),
						('partner_id.zip','partner_invoice_id_zip'),
						('partner_id.country_id.name','partner_invoice_id_country_id_name'),
						('partner_id.phone','partner_invoice_id_phone'),
						('partner_id.contact','partner_invoice_id_contact'),
						('partner_id.email','partner_invoice_id_email'),						
						
						('number','name'),
						('date_invoice','date_order'),						
						
						('port_load_id.name','', upper),
						('port_discharge_id.name','', upper),
						
						'amount_total',
						('amount_total', 'amount_total_en', number2words_en_upper2),
						
						'incoterm.name',

						'total_shipped',
						'contract_n',
						'bl_number',
						'container_no',
						'seal_no',
						'serial_no',
						'hs_code',
						
						('currency_id.symbol','currency_symbol'),						
						('currency_id.name','currency_name'),	
						
						'comment',
						'addion_comment',
						
						#for service invoice
						('parent_id.number','prod_inv_name'),
						#dm added
						('company_id.img_stamp','company_stamp'),
						('origin_inv_id.number','origin_inv_name')
						
						]
			
			partner_invoice_id_name_upper = '%s - %s'%(order.partner_id.ref, upper(order.partner_id.name))
			order_fields_new = order_fields + [{'partner_invoice_id_name_upper':partner_invoice_id_name_upper}]
			order_xml = get_rubylong_fields_xml_body(order, order_fields_new)
			
			#partner shipping address			
			sale_order = self.sale_order(cr, uid, order.id, context=context)
			if sale_order:
				order_fields = [
							('partner_shipping_id.name','partner_shipping_id_name'),
							('partner_shipping_id.name', 'partner_shipping_id_name_upper', upper),
							('partner_shipping_id.street','partner_shipping_id_street'),
							('partner_shipping_id.street2','partner_shipping_id_street2'),
							('partner_shipping_id.city','partner_shipping_id_city'),
							('partner_shipping_id.zip','partner_shipping_id_zip'),
							('partner_shipping_id.country_id.name','partner_shipping_id_country_id_name'),
							('partner_shipping_id.phone','partner_shipping_id_phone'),
							('partner_shipping_id.contact','partner_shipping_id_contact'),
							('partner_shipping_id.email','partner_shipping_id_email'),	
							('client_order_ref','', upper),
							]
				order_xml += get_rubylong_fields_xml_body(sale_order, order_fields)
			
			#add this order's xml
			data_xml = "<%s>%s</%s>"%('header', order_xml, 'header')			
			
			#detail data
			line_fields = [
						('invoice_id.id','order_id'),
						('id','order_line_id'),
						('quantity','product_qty'),
						('uos_id.name','product_uom_name'),
						'price_unit',
						'price_subtotal',
						('invoice_id.currency_id.symbol','currency_symbol')
						]
			
			for line in order.invoice_line:
				line_xml = get_rubylong_fields_xml_body(line, line_fields)
				#add item_no, item_name
				customer = order.partner_id.parent_id and order.partner_id.parent_id or order.partner_id
				prod_customer = self.pool.get('product.product').get_customer_product(cr, uid, customer.id, line.product_id.id, context=context)
				if prod_customer:
					line_xml += get_rubylong_fields_xml_body(prod_customer, [('product_code','item_no'), ('product_name','item_name')])
				#add full xml
				data_xml += "<%s>%s</%s>"%('detail', line_xml, 'detail')

			#write data to file			
			res[order.id] = get_rublong_data_url(order,data_xml,cr.dbname)

		return res			
예제 #11
0
파일: invoice.py 프로젝트: newmooncn/actin
	def _rubylong_xml_file_dn(self, cr, uid, ids, field_names, args, context=None):
		if isinstance(ids, (int, long)):
			ids = [ids]
		res = {}
		for po_id in ids:
			res[po_id] = ''
		data_xml = ''
		orders = self.browse(cr, uid, ids, context=context)
		for order in orders:
			data_xml = ''
			#header data
			order_fields = [
						('id','order_id'),
						'company_id.name',
						'company_id.street',
						'company_id.street2',
						'company_id.city',
						'company_id.zip',
						'company_id.country_id.name',
						'company_id.contact',
						'company_id.phone',
						'company_id.fax',
						'company_id.email',
						('company_id.logo','company_logo'),
						
						'partner_id.name',
#						('partner_id.name', 'partner_id_name_upper', upper),
						'partner_id.street',
						'partner_id.street2',
						'partner_id.city',
						'partner_id.zip',
						'partner_id.country_id.name',
						'partner_id.phone',
						'partner_id.contact',
						'partner_id.email',						
						
						('number','name'),
						('date_invoice','date_order'),						
						
						('port_load_id.name','', upper),
						('port_discharge_id.name','', upper),
						
						'amount_total',
						('amount_total', 'amount_total_en', number2words_en_upper2),
						
						'incoterm.name',

						'total_shipped',
						'contract_n',
						'bl_number',
						'container_no',
						'seal_no',
						'serial_no',
						'hs_code',
						
						('currency_id.symbol','currency_symbol'),						
						('currency_id.name','currency_name'),
						'comment',
						'addion_comment',
						
						#dm added
						('company_id.img_stamp','company_stamp'),
						
						#user added
						'qty_carton_total',
						'weight_net_total',
						'weight_gross_total',
						('m3_total','volume_total'),
						('origin_inv_id.number','origin_inv_name')
						]
			
			partner_id_name_upper = '%s - %s'%(order.partner_id.ref, upper(order.partner_id.name))
			order_fields_new = order_fields + [{'partner_id_name_upper':partner_id_name_upper}]
			order_xml = get_rubylong_fields_xml_body(order, order_fields_new)
			
			#partner shipping address			
			purchase_order = self.purchase_order(cr, uid, order.id, context=context)
			if purchase_order:
				order_fields = [
							('name','po_name'),
							('client_order_ref','', upper),
							('port_load_id.name','', upper),
							('port_discharge_id.name','', upper),
							]
				order_xml += get_rubylong_fields_xml_body(purchase_order, order_fields)
			
			#add this order's xml
			data_xml = "<%s>%s</%s>"%('header', order_xml, 'header')			
			
			#detail data
			line_fields = [
						('invoice_id.id','order_id'),
						('id','order_line_id'),
						('product_id.seller_product_name','supplier_item_no'),
						('product_id.description_purchase','supplier_item_name'),
						('quantity','product_qty'),
						('uos_id.name','product_uom_name'),
						'price_unit',
						'price_subtotal',
						('invoice_id.currency_id.symbol','currency_symbol')
						]
			
			for line in order.invoice_line:				
				data_xml += get_rubylong_fields_xml(line, 'detail', line_fields)
		
			#write data to file			
			res[order.id] = get_rublong_data_url(order,data_xml,cr.dbname)
			
		return res