Odoo Help

3

sale_stock not working in Odoo v8

By
E.M.
on 1/10/16, 6:41 AM 951 views

Hi,


I am trying to deploy a custom module which relates certain fields from order to stock.picking.

I was about to use sale_id relation in stock_picking,and  I just realized that sale_id is not in stock_picking table.

I checked sale_stock installation, it seems to be properly installed but the field is not there.

Is there any known issue with sale_stock in Odoo v8?


5

Sudhir Arya (ERP Harbor Consulting Services)

--Sudhir Arya (ERP Harbor Consulting Services)--
11584
| 6 8 8
Ahmedabad, India
--Sudhir Arya (ERP Harbor Consulting Services)--

• Co-Founder & Co-Owner at ERP Harbor Consulting Services

• ERP Consultant / ERP Customization / TechnoFunctional Expert

• Sound knowledge in Python, Odoo (Open ERP), XML, PostgreSQL

• Domain knowledge of Sale Management, Purchase Management, Warehouse Management, Manufacturing, Multi Company Configuration & Management, HR Management, Medical Management, Construction Management, Education Management, Point of Sale, Third Party Integrations

• Positive attitude and quick Learner

• Good analytical skill, quick bug and issue tracing and find the solution

• Good knowledge and experience in payment gateway integration with Odoo

• Ready to accept new challenges

• Active Memeber On Stackoverflow 

LinkedIn

Blog

Stackoverflow

Sudhir Arya
ERP Harbor Consulting Services
skype: 
sudhir@erpharbor.com 
Sudhir Arya (ERP Harbor Consulting Services)
On 1/10/16, 7:06 AM

Hello E.M.,

You are right. There is a field given named "sale_id" in the module. If you go to stock_picking table in the database, you won't see sale_id field.

The reason is that, the field is a function (auto compute) field and is not stored (store=True/False) into the database picking table. That is why you can't use this field in database query but you can access the function field using browse, read method.

Hope this will help you.

It helps a lot. Now I understand. A side question (which is the one that originated this finding), can I reach a field in account_invoice from sales_order? I am trying to reach payment_method from stock_picking via this sale_id.

E.M.
on 1/10/16, 7:47 AM

There is a m2m field called "invoice_ids" in Sale Order which contains all the Invoices related to the SO. https://github.com/odoo/odoo/blob/8.0/addons/sale/sale.py#L220

Sudhir Arya (ERP Harbor Consulting Services)
on 1/10/16, 7:55 AM

Thanks. I tried to extend stock.picking class: @api.depends(''sale_id.invoice_ids','sale_id.invoice_ids.payment_method_id','sale_id.invoice_ids.payment_method_id.name') def _get_payment_terms(self): ... self.payment_method = self.sale_id.invoice_ids and self.sale_id.invoice_ids[0].payment_method_id and self.sale_id.invoice_ids[0].payment_method_id.name or False ... payment_method = fields.Char(compute='_get_payment_terms',string='Payment Method',readonly=True) But when loading the module it says fields = [model._fields[head]] KeyError: 'payment_method_id' Is there anything obvious I could be missing?

E.M.
on 1/10/16, 8:20 AM

Would you please create a new question for this? It will be hard to answer in comment.

Sudhir Arya (ERP Harbor Consulting Services)
on 1/10/16, 8:24 AM

You are right, I will do it right now.

E.M.
on 1/10/16, 8:30 AM
0
Dr Obx
On 1/10/16, 1:41 PM

Great job ;)

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 1/10/16, 6:41 AM
Seen: 951 times
Last updated: 9/30/16, 3:22 PM