Created on 2020-09-17.13:30:48 by pokoli, last changed yesterday by reviewbot.
You can have the creation method like this: for supplier in …: quotations.append(self.get_quotation(supplier)) Quotation.save(quotations) def get_quotation(self, supplier): … for key, grouped_requests in groupby(…): for r in grouped_requests: lines.append(self.get_quotation_line(request)) quotation.lines = lines return quotation
I'm not sure to understand what do you mean (because there are three lops on the code). Could you please clarify it?
On 2020-09-17 15:18, Sergi Almacellas Abellana wrote: > > Indeed I think it will be better to externalize the quotation instantiation out of the loop. > > It won't work for our use case as each quotation has a diferent supplier, so it must be done inside the loop. It will work if done properly by doing a second loop on the quotation lines.
El 17/9/20 a les 15:03, Cédric Krier ha escrit: > For me, it is not clear what could be customized on the line depending on the parent. Our requirement is to customize the description using the values from product_supplier table (include supplier name and code if available) > Indeed I think it will be better to externalize the quotation instantiation out of the loop. It won't work for our use case as each quotation has a diferent supplier, so it must be done inside the loop.
For me, it is not clear what could be customized on the line depending on the parent. Indeed I think it will be better to externalize the quotation instantiation out of the loop.
One may be interested on customizing the lines values depending on the supplier used but this is not currently possible because the field is not available on the request: https://hg.tryton.org/modules/purchase_request_quotation/file/1789591561e2/purchase.py#l524 So I think we should factorize the method to pass also the newly created quotation so we can read the supplier and other values.
|2021-04-09 17:15:21||reviewbot||set||messages: + msg66237|
|2021-04-07 17:14:07||reviewbot||set||messages: + msg66154|
messages: + msg60292
|2020-09-22 00:07:33||ced||set||messages: + msg60257|
|2020-09-18 13:35:40||pokoli||set||assignedto: pokoli|
messages: + msg60225
|2020-09-17 15:47:03||ced||set||messages: + msg60199|
|2020-09-17 15:18:18||pokoli||set||messages: + msg60197|
+ ced, - reviewbot|
messages: + msg60196
messages: + msg60189
|2020-09-17 13:31:57||pokoli||set||status: in-progress -> testing|
keyword: + review
Showing 10 items. Show all history (warning: this could be VERY long)