l10n_pl_tax_office.py 634 B

1234567891011121314151617181920212223
  1. from odoo import fields, models
  2. class TaxOffice(models.Model):
  3. _name = 'l10n_pl_tax_office'
  4. _description = 'Tax Office in Poland'
  5. _rec_names_search = ['name', 'code']
  6. _order = 'code'
  7. code = fields.Char('Code', required=True)
  8. name = fields.Char('Description', required=True)
  9. _sql_constraints = [
  10. ('code_company_uniq', 'unique (code)', 'The code of the tax office must be unique !')
  11. ]
  12. def name_get(self):
  13. result = []
  14. for tax_office in self:
  15. name = tax_office.code + ' ' + tax_office.name
  16. result.append((tax_office.id, name))
  17. return result