mirror of
https://github.com/OCA/rma.git
synced 2025-02-16 17:11:47 +02:00
Merge pull request #70 from factorlibre/8.0-default-fix
[FIX] crm_claim_rma: Fixed company_id default fields
This commit is contained in:
@@ -44,6 +44,13 @@ class ClaimLine(models.Model):
|
|||||||
_description = "List of product to return"
|
_description = "List of product to return"
|
||||||
_rec_name = "display_name"
|
_rec_name = "display_name"
|
||||||
|
|
||||||
|
@api.model
|
||||||
|
def _get_company_default(self):
|
||||||
|
company_env = self.env['res.company']
|
||||||
|
default_company_id = company_env._company_default_get(
|
||||||
|
'claim.line')
|
||||||
|
return company_env.browse(default_company_id)
|
||||||
|
|
||||||
SUBJECT_LIST = [('none', 'Not specified'),
|
SUBJECT_LIST = [('none', 'Not specified'),
|
||||||
('legal', 'Legal retractation'),
|
('legal', 'Legal retractation'),
|
||||||
('cancellation', 'Order cancellation'),
|
('cancellation', 'Order cancellation'),
|
||||||
@@ -71,8 +78,7 @@ class ClaimLine(models.Model):
|
|||||||
company_id = fields.Many2one(
|
company_id = fields.Many2one(
|
||||||
'res.company', string='Company', readonly=False,
|
'res.company', string='Company', readonly=False,
|
||||||
change_default=True,
|
change_default=True,
|
||||||
default=lambda self: self.env['res.company']._company_default_get(
|
default=_get_company_default)
|
||||||
'claim.line'))
|
|
||||||
date = fields.Date('Claim Line Date',
|
date = fields.Date('Claim Line Date',
|
||||||
select=True,
|
select=True,
|
||||||
default=fields.date.today())
|
default=fields.date.today())
|
||||||
|
|||||||
@@ -40,6 +40,13 @@ class CrmClaim(models.Model):
|
|||||||
_('There is no warehouse for the current user\'s company.'))
|
_('There is no warehouse for the current user\'s company.'))
|
||||||
return wh
|
return wh
|
||||||
|
|
||||||
|
@api.model
|
||||||
|
def _get_company_default(self):
|
||||||
|
company_env = self.env['res.company']
|
||||||
|
default_company_id = company_env._company_default_get(
|
||||||
|
'claim.line')
|
||||||
|
return company_env.browse(default_company_id)
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def name_get(self):
|
def name_get(self):
|
||||||
res = []
|
res = []
|
||||||
@@ -49,9 +56,7 @@ class CrmClaim(models.Model):
|
|||||||
return res
|
return res
|
||||||
|
|
||||||
company_id = fields.Many2one(change_default=True,
|
company_id = fields.Many2one(change_default=True,
|
||||||
default=lambda self:
|
default=_get_company_default)
|
||||||
self.env['res.company']._company_default_get(
|
|
||||||
'crm.claim'))
|
|
||||||
|
|
||||||
claim_line_ids = fields.One2many('claim.line', 'claim_id',
|
claim_line_ids = fields.One2many('claim.line', 'claim_id',
|
||||||
string='Return lines')
|
string='Return lines')
|
||||||
|
|||||||
Reference in New Issue
Block a user