Maxime Chambreuil
6 years ago
5 changed files with 60 additions and 13 deletions
-
1agreement/models/__init__.py
-
10agreement/models/agreement.py
-
22agreement/models/agreement_line.py
-
21agreement/views/agreement.xml
-
19agreement/views/res_config_settings.xml
@ -0,0 +1,22 @@ |
|||||
|
# 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 |
Write
Preview
Loading…
Cancel
Save
Reference in new issue