Skip to Content
Menu
This question has been flagged
1 Atsakyti
3920 Rodiniai

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 

Portretas
Atmesti
Best Answer

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!

Portretas
Atmesti
Related Posts Replies Rodiniai Veikla
1
birž. 22
2819
1
geg. 22
4635
0
vas. 22
3843
0
rugs. 21
2981
2
rugp. 24
1582