company.py 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. # -*- coding: utf-8 -*-
  2. from odoo.osv import expression
  3. from odoo.tools.float_utils import float_round as round
  4. from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT
  5. from odoo.exceptions import UserError, ValidationError
  6. from odoo import api, fields, models, _
  7. class ResCompany(models.Model):
  8. _inherit = 'res.company'
  9. #Location
  10. location_country_id = fields.Many2one('ecom.location', 'Country', track_visibility='onchange',index=True)
  11. island_id = fields.Many2one('ecom.location', 'Island', track_visibility='onchange',index=True)
  12. county_id = fields.Many2one('ecom.location', 'County', track_visibility='onchange',index=True)
  13. parish_id = fields.Many2one('ecom.location', 'Parish', track_visibility='onchange',index=True)
  14. local_id = fields.Many2one('ecom.location', 'Local', track_visibility='onchange',index=True)
  15. neighborhood_id = fields.Many2one('ecom.location', 'Neighborhood', track_visibility='onchange',index=True)
  16. #
  17. state = fields.Selection([('draft', 'New'),
  18. ('conceived', 'Conceived'),
  19. ('approved', 'Approved'),
  20. ('mounted', 'Mounted'),
  21. ('inserted', 'Inserted'),('online', 'Online'),('cancel', 'Cancelled')], 'State', default='draft', track_visibility='onchange',translate=False,index=True)
  22. company_type_id = fields.Many2one('ecom.ebusiness.type', 'Company type',index=True)
  23. customer_id = fields.Many2one('ecom.customer', 'Customer',index=True)
  24. one_page = fields.Boolean('One Page', default=False)
  25. has_site = fields.Boolean('Has site', default=False)
  26. site = fields.Char(string='Site')
  27. date_online = fields.Date(string='Date Online')
  28. #Safepay tab
  29. pos_id = fields.Char(string='ID Terminal 24')
  30. posautcode = fields.Char(string='POS Auth code')
  31. url_sisp = fields.Char(string='SISP URL')
  32. business_registration = fields.Char(string='Business Registration')
  33. #Contracts tab
  34. contract_ebusiness_ids = fields.Many2many('ecom.contract', 'res_company_contract_rel', 'company_id', 'contract_id', string='Contracts', copy=False)
  35. #System
  36. api_key = fields.Char(string='API Key')
  37. captcha_key = fields.Char(string='Captcha Key')
  38. _sql_constraints = [
  39. ('pos_id_uniq', 'unique (pos_id)', 'The pos_id of the ebusiness must be unique per ebusiness !'),
  40. ('posautcode', 'unique (posautcode)', 'The posautcode of the ebusiness must be unique per ebusiness !')
  41. ]