Odoo Help

0
1
Faheem Khan
On 10/12/18, 6:45 AM

I had solved the issue.

The proper code is.

from odoo.exceptions import ValidationError


class ProductTemplateInherit(models.Model):
_inherit = 'product.template'

x_discount = fields.Float(digits=dp.get_precision('Discount'), store=True, readonly=False)


class SaleOrderLineDiscount(models.Model):
_inherit = 'sale.order.line'
x_cotton_qty = fields.Float(string='Cotton Qty', digits=dp.get_precision('Qty'), store=True, readonly=False)
x_pcs_qty = fields.Float(string='PCS Qty', digits=dp.get_precision('Qty'), store=True, readonly=False)

@api.depends('x_cotton_qty', 'x_pcs_qty', 'product_id')
def _comput_from_cotton(self):
for line in self:
line.product_uom_qty = line.x_cotton_qty * line.product_id.uom_po_id.factor_inv + line.x_pcs_qty

product_uom_qty = fields.Float(compute='_comput_from_cotton', string='Quantity',
digits=dp.get_precision('Product Unit of Measure'), required=True, default=1.0)

About This Community

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

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: 10/11/18, 6:39 AM
Seen: 212 times
Last updated: 10/12/18, 6:45 AM