Files
contract/agreement/models/agreement_line.py
Maxime Chambreuil 215a291eaa [ADD] agreement.line
2018-12-26 10:03:20 -06:00

23 lines
816 B
Python

# Copyright (C) 2018 - TODAY, Pavlov Media
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
class AgreementLine(models.Model):
_name = 'agreement.line'
_description = 'Agreement Lines'
product_id = fields.Many2one('product.product', string='Product')
name = fields.Char(string="Description", required=True)
agreement_id = fields.Many2one('agreement', string="Agreement",
ondelete="cascade")
qty = fields.Float(string='Quantity')
uom_id = fields.Many2one('product.uom', string='Unit of Measure',
required=True)
@api.onchange('product_id')
def _onchange_product_id(self):
self.name = self.product_id.name
self.uom_id = self.product_id.uom_id.id