Localization for Freight (customer.lang)
							parent
							
								
									46959ed0ff
								
							
						
					
					
						commit
						fdf85383b8
					
				|  | @ -393,7 +393,7 @@ class SaleOrder(models.Model): | ||||||
|         order_name = vals.get('order_name', False) |         order_name = vals.get('order_name', False) | ||||||
|         order_line_vals = vals.get('order_lines', False) |         order_line_vals = vals.get('order_lines', False) | ||||||
|         order_id = self.search([('name', '=', order_name)], order='id DESC',limit=1) |         order_id = self.search([('name', '=', order_name)], order='id DESC',limit=1) | ||||||
|         order_id.pg_create_order_lines(order_line_vals) |         order_id.pg_create_order_lines(order_line_vals,order_id.partner_id.lang) | ||||||
|         return {'id': order_id.id, 'name': order_id.name} |         return {'id': order_id.id, 'name': order_id.name} | ||||||
| 
 | 
 | ||||||
|     @api.model |     @api.model | ||||||
|  | @ -516,7 +516,7 @@ class SaleOrder(models.Model): | ||||||
|         if attachment_vals: |         if attachment_vals: | ||||||
|             order_id.pg_create_sale_order_attachments(attachment_vals) |             order_id.pg_create_sale_order_attachments(attachment_vals) | ||||||
|         if order_line_vals: |         if order_line_vals: | ||||||
|             order_id.pg_create_order_lines(order_line_vals) |             order_id.pg_create_order_lines(order_line_vals,order_id.partner_id.lang) | ||||||
|         if vals.get('confirm_order'): |         if vals.get('confirm_order'): | ||||||
|             order_id.action_confirm() |             order_id.action_confirm() | ||||||
|         return {'id': order_id.id, 'name': order_id.name} |         return {'id': order_id.id, 'name': order_id.name} | ||||||
|  | @ -531,10 +531,10 @@ class SaleOrder(models.Model): | ||||||
|             self.create_attachment(self, values) |             self.create_attachment(self, values) | ||||||
| 
 | 
 | ||||||
|     @api.multi |     @api.multi | ||||||
|     def pg_create_order_lines(self, values): |     def pg_create_order_lines(self, values,lang = False): | ||||||
|         order_lines = [] |         order_lines = [] | ||||||
|         for vals in values: |         for vals in values: | ||||||
|             vals = self.env['sale.order.line'].correct_values(vals) |             vals = self.env['sale.order.line'].correct_values(vals,lang) | ||||||
| 
 | 
 | ||||||
|             lot_id = False |             lot_id = False | ||||||
|             if vals.get('lot_id', False): |             if vals.get('lot_id', False): | ||||||
|  | @ -557,7 +557,7 @@ class SaleOrder(models.Model): | ||||||
|             order_lines.append(self.env['sale.order.line'].create({ |             order_lines.append(self.env['sale.order.line'].create({ | ||||||
|                 'order_id': self.id, |                 'order_id': self.id, | ||||||
|                 'sequence': vals['sequence'], |                 'sequence': vals['sequence'], | ||||||
|                 'name': vals['name'], |                 'name': vals.get('name'), | ||||||
|                 'product_id': vals['product_id'], |                 'product_id': vals['product_id'], | ||||||
|                 'price_unit': vals['price_unit'], |                 'price_unit': vals['price_unit'], | ||||||
|                 'product_uom_qty': vals['product_uom_qty'], |                 'product_uom_qty': vals['product_uom_qty'], | ||||||
|  | @ -936,11 +936,14 @@ class SaleOrderLine(models.Model): | ||||||
|     #     return vals |     #     return vals | ||||||
| 
 | 
 | ||||||
|     @api.model |     @api.model | ||||||
|     def correct_values(self, vals): |     def correct_values(self, vals,lang): | ||||||
|         if vals.get('product_id', False): |         if vals.get('product_id', False): | ||||||
|             product_id = self.env['product.product'].search([('default_code', '=', vals['product_id'])]) |             product_id = self.env['product.product'].with_context(lang=lang).search([('default_code', '=', vals['product_id'])]) | ||||||
|             if product_id: |             if product_id: | ||||||
|                 vals['product_id'] = product_id.id |                 vals['product_id'] = product_id.id | ||||||
|  |                 if not vals.get('name',False): | ||||||
|  |                     vals['name'] = product_id.name | ||||||
|  | 
 | ||||||
|                 delay = product_id.product_tmpl_id.sale_delay |                 delay = product_id.product_tmpl_id.sale_delay | ||||||
|                 # if vals.get('delivery_date',False): |                 # if vals.get('delivery_date',False): | ||||||
|                 #     dlvd = datetime.strptime(vals.get('delivery_date'),'%d.%m.%Y').date() |                 #     dlvd = datetime.strptime(vals.get('delivery_date'),'%d.%m.%Y').date() | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue