Skip to Content
Menu
This question has been flagged
1 Reply
3665 Views

Code for custom module for product.template:

# -*- coding: utf-8 -*-

from openerp import models, fields, api

class myfieldinproduct(models.Model):

_inherit = 'product.template'

#Add custom field "reg_model"

reg_model = fields.Char('Model', default='NL-XXXX-XXX')

....

My code for custom module for sale.order:

# -*- coding: utf-8 -*-

from openerp import models, fields, api

class myfieldinsaleorder(models.Model):

_inherit = 'sale.order'

#Add custom field "reg_model"

reg_modelinsaleorder = fields.Char('Model', default='NL-XXXX-XXX')

In this point how i can get the value of "reg_model" from product.template custom module (myfieldinproduct) and assing to reg_modelinsaleorder

....

Example:

in produc.template have a custom field "mycolor"

in sale.order have a custom field "hiscolor"

hiscolor = mycolor some thing like that.

Thank you.



Avatar
Discard
Best Answer

Hello,

I just don't understand something: that is the sale order can contains several lines with products ! it'll be more logical if you added your custom field to sale order line rather than the sale order.

Usually to fetch some values you can use onchange method, or make the fields related.

You can check how the system fetch the product's information in the sale order line in this method So most probably you'll need to override this function ...

Hope this could help

Avatar
Discard
Author

for example i need know how many products in budgets (quotations) are pink, how many products are blue... For example in products for store values i add several custom fields for computers like product_ memory_capacity, product_cpu_speed, product_hdd_capacity because i need to see this values in listview(treeeview) like list prices... In the case of the sale order to store values i will add the same fields like salorder_memory_capacity, saleorder_cpu_speed, saleorder_hdd_capacity BECAUSE i need to make a filter in listview (treeview) to know how many computer in salorder_ memory_capacity = 8GB, or 4 GB... or saleorder_cpu_speed = 2.7GHz or 3.0 GHz... And also In this point when i create a new budgets (quotations) i need to fill this values with hand, and i will like to get default values from the current product in sale order line because maybe just the memory capacity was changed. And yes, i use just one product for every budgets (quotations) in sale order line, of course i do not sell computers.

Related Posts Replies Views Activity
0
Jul 22
852
1
Dec 24
46
2
Feb 24
403
0
Feb 24
305
2
Oct 23
1103