123456789101112131415161718192021222324252627282930313233343536373839404142 |
- # -*- coding: utf-8 -*-
- from openerp.http import request as r
- def get_suppliers():
- domain = [
- ('supplier', '=', True),
- ('active', '=', True)
- ]
- return [
- {
- 'id': s.id,
- 'name': s.name,
- 'displayName': s.display_name,
- 'image': s.image_medium,
- 'ruc': s.ruc,
- 'phone': s.phone,
- 'mobile': s.mobile,
- 'email': s.email
- } for s in r.env['res.partner'].search(domain)
- ]
- def create_supplier(values):
- s = r.env['res.partner'].create({
- 'name': values.get('name'),
- 'ruc': values.get('ruc'),
- 'phone': values.get('phone'),
- 'supplier': True,
- 'customer': False
- })
- return {
- 'id': s.id,
- 'name': s.name,
- 'displayName': s.display_name,
- 'imageMedium': s.image_medium,
- 'phone': s.phone,
- 'mobile': s.mobile,
- 'email': s.email
- }
|