Re: [tryton-dev] After upgrade "Method" not callable
Am Montag, 25. Juni 2018 09:40:05 UTC+2 schrieb Cédric Krier: > On 2018-06-25 00:10, 'Hendrik Brandes' via tryton-dev wrote: > > Am Samstag, 23. Juni 2018 23:55:05 UTC+2 schrieb Cédric Krier: > > > On 2018-06-23 09:31, 'Hendrik Brandes' via tryton-dev wrote: > > > > I tried to migrate an existing tryton installation and get the > > > > following error: > > > > > > > > AssertionError: .margin not callable > > > > > > What is the traceback? > > > > I started the trytond-admin command with parameter --all and finally got > > the following traceback: > > > > Traceback (most recent call last): > > File "/opt/projekte/git/tryton2018/EBBTryton2018/bin/trytond-admin", line > > 21, in > > admin.run(options) > > File "/opt/projekte/git/tryton2018/EBBTryton2018/trytond/admin.py", line > > 54, in run > > activatedeps=options.activatedeps) > > File "/opt/projekte/git/tryton2018/EBBTryton2018/trytond/pool.py", line > > 162, in init > > lang=lang, activatedeps=activatedeps) > > File > > "/opt/projekte/git/tryton2018/EBBTryton2018/trytond/modules/__init__.py", > > line 406, in load_modules > > _load_modules(update) > > File > > "/opt/projekte/git/tryton2018/EBBTryton2018/trytond/modules/__init__.py", > > line 376, in _load_modules > > load_module_graph(graph, pool, update, lang) > > File > > "/opt/projekte/git/tryton2018/EBBTryton2018/trytond/modules/__init__.py", > > line 165, in load_module_graph > > pool.setup(classes) > > File "/opt/projekte/git/tryton2018/EBBTryton2018/trytond/pool.py", line > > 236, in setup > > cls.__setup__() > > File > > "/opt/projekte/git/tryton2018/EBBTryton2018/trytond/modules/sale_margin/sale.py", > > line 109, in __setup__ > > super(SaleLine, cls).__setup__() > > File > > "/opt/projekte/git/tryton2018/EBBTryton2018/trytond/modules/sale_price_list/sale.py", > > line 49, in __setup__ > > super(SaleLine, cls).__setup__() > > File > > "/opt/projekte/git/tryton2018/EBBTryton2018/trytond/modules/sale_discount/sale.py", > > line 56, in __setup__ > > super(SaleLine, cls).__setup__() > > File > > "/opt/projekte/git/tryton2018/EBBTryton2018/trytond/modules/sale/sale.py", > > line 1120, in __setup__ > > super(SaleLine, cls).__setup__() > > File "/opt/projekte/git/tryton2018/EBBTryton2018/trytond/model/order.py", > > line 15, in __setup__ > > super(SequenceOrderedMixin, cls).__setup__() > > File > > "/opt/projekte/git/tryton2018/EBBTryton2018/trytond/model/modelsql.py", > > line 164, in __setup__ > > super(ModelSQL, cls).__setup__() > > File > > "/opt/projekte/git/tryton2018/EBBTryton2018/trytond/model/modelstorage.py", > > line 59, in __setup__ > > super(ModelStorage, cls).__setup__() > > File > > "/opt/projekte/git/tryton2018/EBBTryton2018/trytond/model/modelview.py", > > line 194, in __setup__ > > setup_field(name, field, attribute) > > File > > "/opt/projekte/git/tryton2018/EBBTryton2018/trytond/model/modelview.py", > > line 175, in setup_field > > "%s.%s not callable" % (cls, meth_name) > > AssertionError: .margin not callable > > > This looks like you have defined 'margin' in the methods argument of > fields.depends. Something like: @fields.depends(methods=['margin']) > But margin is a field not a method, so it should be: > @fields.depends('margin') Thank you! That did it, I looked inside the margin-field declaration, but it was in another field, which had this declaration inside. > > -- > Cédric Krier - B2CK SPRL > Email/Jabber: cedric.kr...@b2ck.com > Tel: +32 472 54 46 59 > Website: http://www.b2ck.com/ -- You received this message because you are subscribed to the Google Groups "tryton-dev" group. To view this discussion on the web visit https://groups.google.com/d/msgid/tryton-dev/75af6140-3c3e-4c75-8b32-b52d8de3dfe7%40googlegroups.com.
Re: [tryton-dev] After upgrade "Method" not callable
Am Samstag, 23. Juni 2018 23:55:05 UTC+2 schrieb Cédric Krier: > On 2018-06-23 09:31, 'Hendrik Brandes' via tryton-dev wrote: > > I tried to migrate an existing tryton installation and get the following > > error: > > > > AssertionError: .margin not callable > > What is the traceback? I started the trytond-admin command with parameter --all and finally got the following traceback: Traceback (most recent call last): File "/opt/projekte/git/tryton2018/EBBTryton2018/bin/trytond-admin", line 21, in admin.run(options) File "/opt/projekte/git/tryton2018/EBBTryton2018/trytond/admin.py", line 54, in run activatedeps=options.activatedeps) File "/opt/projekte/git/tryton2018/EBBTryton2018/trytond/pool.py", line 162, in init lang=lang, activatedeps=activatedeps) File "/opt/projekte/git/tryton2018/EBBTryton2018/trytond/modules/__init__.py", line 406, in load_modules _load_modules(update) File "/opt/projekte/git/tryton2018/EBBTryton2018/trytond/modules/__init__.py", line 376, in _load_modules load_module_graph(graph, pool, update, lang) File "/opt/projekte/git/tryton2018/EBBTryton2018/trytond/modules/__init__.py", line 165, in load_module_graph pool.setup(classes) File "/opt/projekte/git/tryton2018/EBBTryton2018/trytond/pool.py", line 236, in setup cls.__setup__() File "/opt/projekte/git/tryton2018/EBBTryton2018/trytond/modules/sale_margin/sale.py", line 109, in __setup__ super(SaleLine, cls).__setup__() File "/opt/projekte/git/tryton2018/EBBTryton2018/trytond/modules/sale_price_list/sale.py", line 49, in __setup__ super(SaleLine, cls).__setup__() File "/opt/projekte/git/tryton2018/EBBTryton2018/trytond/modules/sale_discount/sale.py", line 56, in __setup__ super(SaleLine, cls).__setup__() File "/opt/projekte/git/tryton2018/EBBTryton2018/trytond/modules/sale/sale.py", line 1120, in __setup__ super(SaleLine, cls).__setup__() File "/opt/projekte/git/tryton2018/EBBTryton2018/trytond/model/order.py", line 15, in __setup__ super(SequenceOrderedMixin, cls).__setup__() File "/opt/projekte/git/tryton2018/EBBTryton2018/trytond/model/modelsql.py", line 164, in __setup__ super(ModelSQL, cls).__setup__() File "/opt/projekte/git/tryton2018/EBBTryton2018/trytond/model/modelstorage.py", line 59, in __setup__ super(ModelStorage, cls).__setup__() File "/opt/projekte/git/tryton2018/EBBTryton2018/trytond/model/modelview.py", line 194, in __setup__ setup_field(name, field, attribute) File "/opt/projekte/git/tryton2018/EBBTryton2018/trytond/model/modelview.py", line 175, in setup_field "%s.%s not callable" % (cls, meth_name) AssertionError: .margin not callable > > -- > Cédric Krier - B2CK SPRL > Email/Jabber: cedric.kr...@b2ck.com > Tel: +32 472 54 46 59 > Website: http://www.b2ck.com/ -- You received this message because you are subscribed to the Google Groups "tryton-dev" group. To view this discussion on the web visit https://groups.google.com/d/msgid/tryton-dev/29f80434-c1f0-4bd9-9583-f7bf9630c694%40googlegroups.com.
[tryton-dev] After upgrade "Method" not callable
Hello, I tried to migrate an existing tryton installation and get the following error: AssertionError: .margin not callable The definition of the field looks like this: margin = fields.Function(fields.Numeric('Margin', digits=(16, Eval('_parent_sale', {}).get('currency_digits', 2)), states={ 'invisible': ~Eval('type').in_(['line', 'subtotal']), 'readonly': ~Eval('_parent_sale'), }, depends=['type', 'amount']), 'on_change_with_margin') and for the implementation: @fields.depends('type', 'amount', 'quantity', 'cost_price', '_parent_sale.currency', '_parent_sale.lines') def on_change_with_margin(self): ''' Return the margin of each sale lines ''' ... I thought, that it is enough, to declare all fields, which are used within the method. Actual, I have read the documentation and saw, that the dependency of fields has been introduced, but I cannot understand, what is missing concretely in this case. Thank you and best regards, Hendrik Brandes -- You received this message because you are subscribed to the Google Groups "tryton-dev" group. To view this discussion on the web visit https://groups.google.com/d/msgid/tryton-dev/6bb94289-7a1a-496a-acf1-2e605ad01fc5%40googlegroups.com.
[tryton-dev] One2Many with virtual Entries in SaleLine
Hello, I have the following use case: We have a module called "sale_discount", which enables discounting rules ( a table ) for different quantities of a product. First I have implemented a wizard like TestPaymentTerm, to display the different values. Works nice. Second, I want to display this as a separate page in the sale_line_form, so the user can see each condition of the product. In SaleLine, I want to define the pricing_info as following: pricing_info = fields.One2Many('ebb.product.pricing.test.result', None, 'Result', readonly=True) The method on_change_with_pricing_info returns the values and works also: @fields.depends('product', 'unit', 'pricing_info') def on_change_with_pricing_info(self): ... self.result = result return self._changed_values.get('result', []) but when I execute this in the client on a sale I get the error ... File "/trytond/model/fields/one2many.py", line 84, in get field = Relation._fields[self.field] KeyError: None ... I understand, that the One2Many needs a reference to the parent, but why does this works in the TestPaymentTerm Dialog? I guess, this might be the fact, that in the dialog is no reference to something else and only the tree/list of the PaymentTermResult is displayed. What will be a good way to implement such a feature in the sale_line? Does it need, to create a ModelSQL? Currently, the class "result" is implemented as ModelView with the needed fields as readonly. I do not want to store every discount for each product within the database. Thank you and best regards, Hendrik -- You received this message because you are subscribed to the Google Groups "tryton-dev" group. To view this discussion on the web visit https://groups.google.com/d/msgid/tryton-dev/2fb0a467-b617-4dc4-8ba8-8da3c3824199%40googlegroups.com.