| 1 |
|
| 2 |
from odoo import api, fields, models |
| 3 |
|
| 4 |
|
| 5 |
class L10nMyEdiIndustryClassification(models.Model): |
| 6 |
""" |
| 7 |
These codes are required by the API. They represent the industry classifications that are used in Malaysia. |
| 8 |
As defined in the list of MSIC codes allowed here: https://sdk.myinvois.hasil.gov.my/codes/msic-codes/ |
| 9 |
|
| 10 |
Made a model as the list of codes would be too long for a selection field, yet it is easier to provide users with |
| 11 |
the list than expect them to find and then enter both name and code manually. |
| 12 |
""" |
| 13 |
_name = 'l10n_my_edi.industry_classification' |
| 14 |
_description = "Malaysian Industry Classification" |
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
name = fields.Char(required=True) |
| 21 |
code = fields.Char(required=True) |
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
@api.depends('code') |
| 28 |
def _compute_display_name(self): |
| 29 |
for classification in self: |
| 30 |
classification.display_name = f"{classification.code} {classification.name}" |