تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
3917 أدوات العرض

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 

الصورة الرمزية
إهمال
أفضل إجابة

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!

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
1
يونيو 22
2819
1
مايو 22
4634
0
فبراير 22
3842
0
سبتمبر 21
2980
2
أغسطس 24
1580