Files
intrastat-extrastat/intrastat_base/models/product_template.py
Raphaël Valyi 5f9f95c17d [IMP] *: removed utf-8 headers, changed icon and site
* company model test, country model test as in v8
* png logo instead of svg, removed Python 2 utf-8 headers

[UPD] squashed administrative commits
2020-10-14 10:05:34 +02:00

28 lines
1.1 KiB
Python

# © 2010-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models, fields, api, _
from odoo.exceptions import ValidationError
class ProductTemplate(models.Model):
_inherit = "product.template"
is_accessory_cost = fields.Boolean(
string='Is accessory cost',
help="Activate this option for shipping costs, packaging "
"costs and all services related to the sale of products. "
"This option is used for Intrastat reports.")
@api.multi
@api.constrains('type', 'is_accessory_cost')
def _check_accessory_cost(self):
for this in self:
if this.is_accessory_cost and this.type != 'service':
raise ValidationError(
_("The option 'Is accessory cost?' should only be "
"activated on 'Service' products. You have activated "
"this option for the product '%s' which is of type "
"'%s'") %
(this.name, this.type))