Files
intrastat-extrastat/product_harmonized_system/models/product_template.py
Tom 244adcaf26 9.0 mig product harmonized system (#7)
* Backport from 10.0 to 9.0: import odoo to import openerp, <odoo> to <openerp>, bring back <data> if noupdate=1, rename __manifest__.py to __openerp__.py, downgrade version number to 9.0.1.0.0, and make module installable.

* Re-add H.S.codes menu item under Sales-Product-Configuration.
(it had been removed to remove the reference to product module, but I don't understand that decision since this module by nature depends on product module anyway)

* Added module tests.

* flake8

* Encoding lines at the beginning of python files
2016-11-21 16:53:50 +01:00

36 lines
1.2 KiB
Python

# -*- coding: utf-8 -*-
# © 2011-2016 Akretion (http://www.akretion.com)
# © 2009-2016 Noviat (http://www.noviat.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# @author Luc de Meyer <info@noviat.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import models, fields, api
class ProductTemplate(models.Model):
_inherit = "product.template"
hs_code_id = fields.Many2one(
'hs.code', string='H.S. Code',
company_dependent=True, ondelete='restrict',
help="Harmonised System Code. Nomenclature is "
"available from the World Customs Organisation, see "
"http://www.wcoomd.org/. You can leave this field empty "
"and configure the H.S. code on the product category.")
origin_country_id = fields.Many2one(
'res.country', string='Country of Origin',
help="Country of origin of the product i.e. product "
"'made in ____'.")
@api.multi
def get_hs_code_recursively(self):
self.ensure_one()
if self.hs_code_id:
res = self.hs_code_id
elif self.categ_id:
res = self.categ_id.get_hs_code_recursively()
else:
res = None
return res