mirror of
https://github.com/bringout/oca-ocb-vertical-industry.git
synced 2026-04-24 02:52:01 +02:00
19.0 vanilla
This commit is contained in:
parent
4607ccbd2e
commit
825ff6514e
487 changed files with 184979 additions and 195262 deletions
|
|
@ -1,7 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import fields, models
|
||||
from odoo import api, fields, models
|
||||
|
||||
from odoo.tools import formatLang
|
||||
|
||||
|
|
@ -14,13 +14,13 @@ class LunchTopping(models.Model):
|
|||
company_id = fields.Many2one('res.company', default=lambda self: self.env.company)
|
||||
currency_id = fields.Many2one('res.currency', related='company_id.currency_id')
|
||||
price = fields.Monetary('Price', required=True)
|
||||
supplier_id = fields.Many2one('lunch.supplier', ondelete='cascade')
|
||||
supplier_id = fields.Many2one('lunch.supplier', ondelete='cascade', index='btree_not_null')
|
||||
topping_category = fields.Integer('Topping Category', required=True, default=1)
|
||||
|
||||
def name_get(self):
|
||||
@api.depends('price')
|
||||
@api.depends_context('company')
|
||||
def _compute_display_name(self):
|
||||
currency_id = self.env.company.currency_id
|
||||
res = dict(super(LunchTopping, self).name_get())
|
||||
for topping in self:
|
||||
price = formatLang(self.env, topping.price, currency_obj=currency_id)
|
||||
res[topping.id] = '%s %s' % (topping.name, price)
|
||||
return list(res.items())
|
||||
topping.display_name = f'{topping.name} {price}'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue