Hello,
I don't know if i found a bug or made a subtle mistake:
I wrote a small module to have list prices and cost prices stored in the
product not just in the template.
If i install or update the module with trytond-admin it works fine, but
when i update any module with the client, it gets broken and the prices
are greyed out in the product(variant) form again. when i update my
module with trytond-admin again it works again.
i use trytond 4.2 with postgresql
the command that gets it running is:
trytond-admin -c ./trytond.conf -d tryton2 -u product_variant_price
i did a DB-dump in the broken state and after running trytond-admin. The
difference are just different timestamps in the tables ir_cache, ir_lang
and ir_model_data and the changed lines in ir_cache and ir_model_data
are listed in another position.
Can this be the reason for a module working or not?
Best Regards,
Ulrich
here the code of my module:
=== product_variant_price/product.py: ===
# -*- coding: utf-8 -*-
import logging
from trytond.pool import PoolMeta
from trytond.model import fields
from trytond.pyson import Eval
from trytond.modules.product import price_digits
__all__ = ['Product']
logger = logging.getLogger(__name__)
STATES = {
'readonly': ~Eval('active', True),
}
DEPENDS = ['active']
class Product:
__metaclass__ = PoolMeta
__name__ = "product.product"
list_price = fields.Property(fields.Numeric('List Price', states=STATES,
digits=price_digits, depends=DEPENDS))
cost_price = fields.Property(fields.Numeric('Cost Price', states=STATES,
digits=price_digits, depends=DEPENDS))
@classmethod
def __setup__(cls):
if not hasattr(cls, '_no_template_field'):
cls._no_template_field = set()
cls._no_template_field.update(['cost_price', 'list_price'])
super(Product, cls).__setup__()
=== product_variant_price/__init__.py : ===
from trytond.pool import Pool
from .product import *
def register():
Pool.register(
Product,
module='product_variant_price', type_='model')
=== product_variant_price/tryton.cfg : ===
[tryton]
version=4.2.0
depends:
ir
product
xml:
product.xml
=== product_variant_price/product.xml : ===
<?xml version="1.0"?>
<tryton>
<data>
<record model="ir.ui.view" id="product_view_form_simple">
<field name="model">product.product</field>
<field name="type" eval="None"/>
<field name="inherit" ref="product.product_view_form_simple"/>
<field name="priority" eval="10"/>
<field name="name">product_form_simple</field>
</record>
</data>
</tryton>
=== product_variant_price/view/procuct_form_simple.xml : ===
<?xml version="1.0"?>
<data>
<xpath expr="/form/field[@name='active']" position="after">
<label name="list_price"/>
<field name="list_price"/>
<label name="cost_price"/>
<field name="cost_price"/>
</xpath>
</data>
--
You received this message because you are subscribed to the Google Groups
"tryton" group.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tryton/925ece57-7d35-960b-fefb-ff81da9c141c%40gmx.de.