Update product_template.py

This commit is contained in:
zainab2097 2024-08-11 11:11:31 +03:00 committed by GitHub
parent b044627ab2
commit 88b60f16cc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 16 additions and 16 deletions

View File

@ -19,23 +19,23 @@ class ProductTemplate(models.Model):
company_id = fields.Many2one('res.company', string='Company', readonly=True,
default=lambda self: self.env.company)
@api.model
def _get_next_projectno(self):
next_sequence = "/ "
sequence = self.env['ir.sequence'].search(
['|', ('company_id', '=', self.env.company[0].id), ('company_id', '=', False),
('code', '=', 'seq.product.template')], limit=1)
if sequence:
next_sequence = sequence.get_next_char(sequence.number_next_actual)
return next_sequence
# @api.model
# def _get_next_projectno(self):
# next_sequence = "/ "
# sequence = self.env['ir.sequence'].search(
# ['|', ('company_id', '=', self.env.company[0].id), ('company_id', '=', False),
# ('code', '=', 'seq.product.template')], limit=1)
# if sequence:
# next_sequence = sequence.get_next_char(sequence.number_next_actual)
# return next_sequence
@api.model
def create(self, vals):
company_id = vals.get('company_id', self.default_get(['company_id'])['company_id'])
self_comp = self.with_company(company_id)
if not vals.get('type_no', False):
vals['type_no'] = self_comp.env['ir.sequence'].next_by_code('seq.product.template') or '/'
return super().create(vals)
# @api.model
# def create(self, vals):
# company_id = vals.get('company_id', self.default_get(['company_id'])['company_id'])
# self_comp = self.with_company(company_id)
# if not vals.get('type_no', False):
# vals['type_no'] = self_comp.env['ir.sequence'].next_by_code('seq.product.template') or '/'
# return super().create(vals)
gender = fields.Selection(
selection=[("male", "Male"), ("female", "Female")], default="male",string='Gender'