Add product html_code (product core or '') (#22)

#163602
This commit is contained in:
nan-tic-dev 2023-11-27 16:42:47 +01:00 committed by GitHub
parent 6e1c612c40
commit 785963a596
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 0 deletions

View File

@ -7,6 +7,7 @@ from . import action
from . import translation
from . import html
from . import engine
from . import product
from . import invoice
from . import production
from . import purchase
@ -30,6 +31,7 @@ def register():
Pool.register_mixin(engine.HTMLReportMixin, Report,
module=module)
product.register(module)
invoice.register(module)
production.register(module)
purchase.register(module)

7
product/__init__.py Normal file
View File

@ -0,0 +1,7 @@
from trytond.pool import Pool
from . import product
def register(module):
Pool.register(
product.Product,
module=module, type_='model', depends=['product'])

12
product/product.py Normal file
View File

@ -0,0 +1,12 @@
from trytond.pool import PoolMeta
from trytond.model import fields
class Product(metaclass=PoolMeta):
__name__ = 'product.product'
html_code = fields.Function(fields.Char(
"HTML Code"), 'get_html_code')
def get_html_code(self, name):
return self.code or ''