Odoo Help

Welcome!

This community 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.

0

Getting customer name in stock.production.lot

By
supreeth
on 9/7/16, 4:13 AM 135 views

hi all,

I have activated track serial number option and purchased a product by adding a serial number to that products.

Now i sold one product to a customer. I can see all the details of a particular product in stock.move like product name, source location, destination location etc. 

But i cant see much information in stock.production.lot(Serial Number/Lots) menu. There we can see only Serial Number, product and One2many table stock.quant. 

My requirement is: When i sale the particular Product to a Customer. His name should be printed with that product name in stock.production.lot(Serial Number/Lots). How can we get that name from sale.order to stock.production.lot

I tried below code.

.py

class WMSStockProductionLot(models.Model):
_inherit = "stock.production.lot"
_description = "WMS Stock Production Lot is used too call customer name"
@api.one
def get_customer(self):
res = self.env['stock.move'].search([], limit=[])
_logger.info("asdadasdasd %s",res)
for a in res:
self.partner_id=a.partner_id.id
return res
partner_id = fields.Many2one('res.partner',compute="get_customer", string='Customer')

.xml

<record id="view_stock_production_form_inherite" model="ir.ui.view">
<field name="name">Stock Production Lot</field>
<field name="model">stock.production.lot</field>
<field name="inherit_id" ref="stock.view_production_lot_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='ref']" position="after">
<field name="partner_id"/>
</xpath>
</field>
</record>

i am getting customer name but it will be written for all the products in (Serial Number/Lots)

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 9/7/16, 4:13 AM
Seen: 135 times
Last updated: 9/7/16, 4:16 AM