Hii,

    I am trying to add a existing product to the stock.inventory.line and 
save it. But i am getting this error,
UserError: ('UserError', (u'The value of the field "Product" on "Stock 
Inventory Line" is not valid according to its domain.', ''))




I tried to check if my error is due to the wrong product, but when i added 
the same product to the invoice it did accept it without any issues.

*the error:*

In [64]: line.save()
---------------------------------------------------------------------------
UserError                                 Traceback (most recent call last)
<ipython-input-64-a73bd6e03d6e> in <module>()
----> 1 line.save()

/usr/local/lib/python2.7/dist-packages/proteus/__init__.pyc in newfunc(*args, 
**kwargs)
    100         def newfunc(*args, **kwargs):
    101             if instance:
--> 102                 return self.func(owner, [instance], *args, **kwargs)
    103             else:
    104                 return self.func(owner, *args, **kwargs)

/usr/local/lib/python2.7/dist-packages/proteus/__init__.pyc in save(cls, 
records)
    747         if create:
    748             values = [r._get_values() for r in create]
--> 749             ids = proxy.create(values, context)
    750             for record, id_ in zip(create, ids):
    751                 record.id = id_

/usr/local/lib/python2.7/dist-packages/proteus/config.pyc in __call__(self, 
*args)
    171             meth = getattr(self._object, self._name)
    172             if not hasattr(meth, 'im_self') or meth.im_self:
--> 173                 result = rpc.result(meth(*args, **kwargs))
    174             else:
    175                 assert rpc.instantiate == 0

/home/projects/new/test/FSERP/trytond/trytond/model/modelsql.pyc in create(cls, 
vlist)
    506         records = cls.browse(new_ids)
    507         for sub_records in grouped_slice(records, cache_size()):
--> 508             cls._validate(sub_records)
    509 
    510         field_names = cls._fields.keys()

/home/projects/new/test/FSERP/trytond/trytond/model/modelstorage.pyc in 
_validate(cls, records, field_names)
    967                     continue
    968 
--> 969                 validate_domain(field)
    970 
    971                 def required_test(value, field_name):

/home/projects/new/test/FSERP/trytond/trytond/model/modelstorage.pyc in 
validate_domain(field)
    926 
    927             for domain, sub_records in domains.iteritems():
--> 928                 validate_relation_domain(field, sub_records, Relation, 
domain)
    929 
    930         def validate_relation_domain(field, records, Relation, domain):

/home/projects/new/test/FSERP/trytond/trytond/model/modelstorage.pyc in 
validate_relation_domain(field, records, Relation, domain)
    949                     if sub_relations != set(finds):
    950                         cls.raise_user_error('domain_validation_record',
--> 951                             error_args=cls._get_error_args(field.name))
    952 
    953         field_names = set(field_names or [])

/home/projects/new/test/FSERP/trytond/trytond/error.pyc in 
raise_user_error(cls, error, error_args, error_description, 
error_description_args, raise_exception)
     72                 return (error, error_description)
     73         if raise_exception:
---> 74             raise UserError(error)
     75         else:
     76             return error

UserError: ('UserError', (u'The value of the field "Product" on "Stock 
Inventory Line" is not valid according to its domain.', ''))


*I also tried to check if the error was in product and here is the 
product._get_eval() result*


In [65]: product._get_eval()
Out[65]: 
{'active': True,
 'boms': [],
 'code': None,
 'cost_price_uom': Decimal('25'),
 'cost_value': Decimal('0.0'),
 'create_date': datetime.datetime(2015, 5, 1, 12, 3, 46, 697984),
 'create_uid': 1,
 'default_uom': 1,
 'description': None,
 'forecast_quantity': 0.0,
 'id': 65,
 'list_price_uom': Decimal('40'),
 'quantity': 0.0,
 'rec_name': u'product',
 'template': 47,
 'type': u'service',
 'write_date': None,
 'write_uid': None}


*I also checked the value of stock.inventory by stock._get_eval(),*

In [66]: stock._get_eval()
Out[66]: 
{'company': 34,
 'create_date': datetime.datetime(2015, 5, 1, 13, 38, 8, 830777),
 'create_uid': 1,
 'date': datetime.date(2015, 5, 1),
 'id': 2,
 'lines': [-25],
 'location': 10,
 'lost_found': 7,
 'rec_name': u'2',
 'state': u'draft',
 'write_date': None,
 'write_uid': None}



I couldn't figure out where the mistake is, i checked the stock module, but 
there existed another product.py file which confuses me as to how there can 
be two products, i mean we already have a product module from which we 
created a module, hence it was confusing a bit.

Regards,
Jitesh


Reply via email to