Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
1 Beantwoorden
3916 Weergaven

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
Annuleer
Beste antwoord

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
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
1
jun. 22
2818
1
mei 22
4633
0
feb. 22
3842
0
sep. 21
2979
2
aug. 24
1576