# -*- coding: utf-8 -*- from openerp import http from helpers import get_data, process_data import logging LOGGER = logging.getLogger(__name__) def make_info_log(log): LOGGER.info('\033[1;34m[INFO] --> \033[m{}'.format(log)) class Purchases(http.Controller): @http.route('/eiru_purchases/init', auth='user', methods=['GET']) def init_purchase(self, **kw): mode = kw.get('mode') make_info_log('Preparing data to {}'.format(mode)) return get_data(mode) # ''' # Create supplier and return data # ''' # @http.route('/eiru_purchases/create_supplier', type='json', auth='user', methods=['POST'], cors='*') # def create_supplier(self, **kw): # self.make_info_log('Creating supplier') # ''' # Create product and return data # ''' # @http.route('/eiru_purchases/create_product', type='json', auth='user', methods=['POST'], cors='*') # def create_product(self, **kw): # self.make_info_log('Creating product') ''' Purchase processing resource route ''' @http.route('/eiru_purchases/process', type='json', auth='user', methods=['POST']) def process_purchase(self, **kw): make_info_log('Processing {}'.format(kw.get('mode'))) return process_data(kw)