Skip to Content
Menu
Dette spørgsmål er blevet anmeldt

Is there anyway by which i can inherit a custom field or column into forecasted report of a product(locations->products-> choose any product -> forecasted 

is there any backend coding tutorial or anything that can help me achieve this goal 


thank you 

Avatar
Kassér
Bedste svar

Hi,

Old question, but figured I'd give an answer still.

I've done this by first inheriting the _prepare_report_line() function from report.stock.report_product_product_replenishment (AbstractModel). You can do this like:

def _prepare_report_line(self, quantity, move_out=None, move_in=None, replenishment_filled=True, product=False, reservation=False):
res = super(ReplenishmentReportInherit, self)._prepare_report_line(quantity, move_out, move_in,
replenishment_filled, product,       reservation)

Then, you can add the necessary data into the "res" variable and return the "res", like:

res['SOME_NAME'] = 'YOUR VARIABLE DATA'

When you've done this, you'll have to inherit the forecast-report template in an XML file, and insert your variable into the table header and body


template id="report_stock_forecasted_inh_shipped" inherit_id="stock.report_product_product_replenishment">
xpath expr="//table[@class='o_report_replenishment table table-bordered']/thead/tr/td[3]" position="after">
td>SOME NAME
/xpath>
xpath expr="//table[@class='o_report_replenishment table table-bordered']/tbody/tr[2]/td[3]" position="after">
td t-esc="line['SOME_NAME'] or ''"/>
/xpath>


Hope this helps!

Avatar
Kassér
Related Posts Besvarelser Visninger Aktivitet
1
jun. 22
2819
1
maj 22
4634
0
feb. 22
3842
0
sep. 21
2980
2
aug. 24
1582