diff options
| author | Robin Heinz <rhe@odoo.com> | 2019-12-10 15:00:18 +0000 |
|---|---|---|
| committer | Pierre Masereel <pim@odoo.com> | 2020-03-30 08:42:26 +0000 |
| commit | fba2f5d33105eb20a4c2689a1ddba97d50c47c40 (patch) | |
| tree | 8be09e20e72f122c4fea2eccf2733ca8520b8fbc /odoo | |
| parent | 1c3d1eed015b2fc19245657ae861a3cb6831bde8 (diff) | |
[FIX] point_of_sale: barcode from pos to base.
Switch the declaration of the field barcode to the base module instead of the point_of_sale module.
closes odoo/odoo#41658
Task-id: 2069831
Related: odoo/enterprise#6736
Related: odoo/upgrade#984
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
Diffstat (limited to 'odoo')
| -rw-r--r-- | odoo/addons/base/models/res_partner.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/odoo/addons/base/models/res_partner.py b/odoo/addons/base/models/res_partner.py index cb5d5f6b174..14e8c634339 100644 --- a/odoo/addons/base/models/res_partner.py +++ b/odoo/addons/base/models/res_partner.py @@ -224,6 +224,7 @@ class Partner(models.Model): commercial_company_name = fields.Char('Company Name Entity', compute='_compute_commercial_company_name', store=True) company_name = fields.Char('Company Name') + barcode = fields.Char(help="Use a barcode to identify this contact.", copy=False, company_dependent=True) # hack to allow using plain browse record in qweb views, and used in ir.qweb.field.contact self = fields.Many2one(comodel_name=_name, compute='_compute_get_ids') @@ -380,6 +381,11 @@ class Partner(models.Model): def onchange_company_type(self): self.is_company = (self.company_type == 'company') + @api.constrains('barcode') + def _check_barcode_unicity(self): + if self.env['res.partner'].search_count([('barcode', '=', self.barcode)]) > 1: + raise ValidationError('An other user already has this barcode') + def _update_fields_values(self, fields): """ Returns dict of write() values for synchronizing ``fields`` """ values = {} |
