Payments terms with proteus

i tried

pay=Payment_terms.find([('name','=','30J')]) #<= this works
party.customer_payment_term = pay #<= this do not works AssertionError
party.payment_terms = pay #<= this do not works AttributeError

i tried reading this :

class Party(ModelSQL, ModelView):
    __name__ = 'party.party'
    customer_payment_term = fields.MultiValue(customer_payment_term)
    supplier_payment_term = fields.MultiValue(supplier_payment_term)
    payment_terms = fields.One2Many(
        'party.party.payment_term', 'party', "Payment Terms")

Your issue might be that pay is a list, and maybe you are trying to assign a list to customer_payment_term.

Try it like this to return the record instead of the list of records:
pay,=Payment_terms.find([('name','=','30J')])

In the case above your list must have only one item.
If there are more items you can use [0] to return the first item, but it will result is not precise.

Btw, you can also run python in interactive mode and test it.
Always take care to access the record instance, not the list of record instances returned by find.

i did not saw that i am too tired /o\ i should have saw that

i do not really understand the python errors. attributeError ok the object do not have that attribute, but assertion was/is really cryptic

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.