|  | @@ -145,7 +145,7 @@ class Purchases(http.Controller):
 | 
	
		
			
				|  |  |                  'quantity': 1,
 | 
	
		
			
				|  |  |                  'price': variant.standard_price
 | 
	
		
			
				|  |  |              } for variant in product.product_variant_ids if variant.active]
 | 
	
		
			
				|  |  | -        } for product in request.env['product.template'].search([('purchase_ok', '=', True), ('standard_price', '>', 0), ('active', '=', True)])]
 | 
	
		
			
				|  |  | +        } for product in request.env['product.template'].search([('purchase_ok', '=', True), ('standard_price', '>=', 0), ('active', '=', True)])]
 | 
	
		
			
				|  |  |          
 | 
	
		
			
				|  |  |      '''
 | 
	
		
			
				|  |  |          Get all incoming and active picking types
 | 
	
	
		
			
				|  | @@ -210,7 +210,7 @@ class Purchases(http.Controller):
 | 
	
		
			
				|  |  |      def init_purchase(self, **kw):
 | 
	
		
			
				|  |  |          self.make_info_log('Sending JSON response')
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        return self.make_response({
 | 
	
		
			
				|  |  | +        return self.make_gzip_response({
 | 
	
		
			
				|  |  |              'date': self.get_server_date(),
 | 
	
		
			
				|  |  |              'user': self.get_user(),
 | 
	
		
			
				|  |  |              'currencies': self.get_currencies(),
 | 
	
	
		
			
				|  | @@ -319,6 +319,36 @@ class Purchases(http.Controller):
 | 
	
		
			
				|  |  |              'state': 'draft'
 | 
	
		
			
				|  |  |          })
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    '''
 | 
	
		
			
				|  |  | +        Confirm purchase order
 | 
	
		
			
				|  |  | +    '''
 | 
	
		
			
				|  |  | +    def confirm_purchase_order(self, purchase_order_id):
 | 
	
		
			
				|  |  | +        purchase_order = request.env['purchase.order'].browse(purchase_order_id)
 | 
	
		
			
				|  |  | +        purchase_order.write({
 | 
	
		
			
				|  |  | +            'state': 'manual'
 | 
	
		
			
				|  |  | +        })
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        return purchase_order.action_confirm()
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    '''
 | 
	
		
			
				|  |  | +        Create invoice from purchase order
 | 
	
		
			
				|  |  | +    '''
 | 
	
		
			
				|  |  | +    def create_invoice(self, purchase_order_id, currency_id, date_now):
 | 
	
		
			
				|  |  | +        purchase_order = request.env['purchase.order'].browse(purchase_order_id)
 | 
	
		
			
				|  |  | +        invoice_id = purchase_order.action_invoice_create()
 | 
	
		
			
				|  |  | +        invoice = request.env['account.invoice'].browse(invoice_id)
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        date_due = parse(date_now) + rd(days=max(invoice.payment_term.line_ids.mapped(lambda x: x.days + x.days2)))
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        invoice.write({
 | 
	
		
			
				|  |  | +            'currency_id': currency_id,
 | 
	
		
			
				|  |  | +            'date_invoice': date_now,
 | 
	
		
			
				|  |  | +            'date_due': date_due.strftime(DATE_FORMAT),
 | 
	
		
			
				|  |  | +            'state': 'open'
 | 
	
		
			
				|  |  | +        })
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        return invoice
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      '''
 | 
	
		
			
				|  |  |          Purchase processing resource route
 | 
	
		
			
				|  |  |      ''' 
 |