# -*- coding: utf-8 -*- from openerp import models, fields ''' Users class with token field for manage authentication ''' class res_users(models.Model): _inherit = 'res.users' jwt_token = fields.Char(string = 'JWT Authentication Token'); def dump(self): return { 'id': self.id, 'name': self.name, 'login': self.login, 'email': self.email, 'image_small': self.image_small, 'image_medium': self.image_medium, 'jwt_token': self.jwt_token, 'company_id': self.company_id.id, 'partner_id': self.partner_id.id, } ''' ''' class res_partner(models.Model): _inherit = 'res.partner' def dump(self): return { 'id': self.id, 'name': self.name, 'display_name': self.display_name, 'phone': self.phone, 'mobile': self.mobile, 'email': self.email, 'birthdate': self.birthdate, 'city': self.city, 'street': self.street, 'partner_latitude': self.partner_latitude, 'partner_longitude': self.partner_longitude, 'image_medium': self.image_medium, 'image_small': self.image_small, 'comment': self.comment, 'phonecall_count': self.phonecall_count, 'opportunity_count': self.opportunity_count, 'meeting_count': self.meeting_count, 'journal_item_count': self.journal_item_count, 'sale_order_count': self.sale_order_count, 'contracts_count': self.contracts_count, 'company_id': self.company_id.id, 'country_id': self.country_id.id } ''' ''' class crm_lead(models.Model): _inherit = 'crm.lead' def dump(self): return { 'id': self.id, 'name': self.name, 'display_name': self.display_name, 'phone': self.phone, 'mobile': self.mobile, 'city': self.city, 'street': self.street, 'street2': self.street2, 'partner_name': self.partner_name, 'contact_name': self.contact_name, 'date_open': self.day_open, 'day_close': self.day_close, 'day_open': self.day_open, 'priority': self.priority, 'probability': self.probability, 'planned_cost': self.planned_cost, 'description': self.description, 'meeting_count': self.meeting_count, 'partner_id': self.partner_id.id, 'company_id': self.company_id.id, 'stage_id': self.stage_id.id, 'campaign_id': self.campaign_id.id, 'country_id': self.country_id.id } ''' ''' class product_template(models.Model): _inherit = 'product.template' def dump(self): return { 'id': self.id, 'company_id': self.company_id.id, 'attribute_line_ids': [line.id for line in self.attribute_line_ids] if self.attribute_line_ids else [], 'default_code': self.default_code if self.default_code else None, 'description': self.description if self.description else None, 'ean13': self.ean13 if self.ean13 else None, 'image_medium': self.image_medium, 'image_small': self.image_small, 'name': self.name, 'list_price': self.list_price, 'purchase_ok': self.purchase_ok, 'qty_available': self.qty_available, 'rental': self.rental, 'sale_ok': self.sale_ok, 'standard_price': self.standard_price, 'type': self.type, 'website_published': self.website_published, 'create_date': self.create_date } ''' ''' class product_attribute_line(models.Model): _inherit = 'product.attribute.line' def dump(self): return { 'attribute_id': self.attribute_id if self.attribute_id else None, 'create_date': self.create_date, 'display_name': self.display_name, 'id': self.id, 'product_tmpl_id': self.product_tmpl_id, 'value_ids': [value.id for value in self.value_ids] if value_ids else [] } ''' ''' class product_attribute_value(models.Model): _inherit = 'product.attribute.value' def dump(self): return { 'attribute_id': self.attribute_id if self.attribute_id else None, 'color': self.color, 'create_date': self.create_date, 'display_name': self.display_name, 'id': self.id, 'name': self.name, 'price_extra': self.price_extra, 'price_ids': [price.id for price in self.price_ids] if self.price_ids else [], 'product_ids': [product.id for product in self.product_ids] if self.product_ids else [] } ''' ''' class product_product(models.Model): _inherit = 'product.product' def dump(self): return { 'active': self.active, 'alternative_product_ids': [alternative.id for alternative in self.alternative_product_ids] if alternative_product_ids else [], 'description': self.description, 'display_name': self.display_name, 'ean13': self.ean13, 'id': self.id, 'is_product_variant': self.is_product_variant, 'list_price': self.list_price, 'name': self.name, 'price': self.price, 'price_extra': self.price_extra }