diff --git a/rma/README.rst b/rma/README.rst index 19617464..041219ca 100644 --- a/rma/README.rst +++ b/rma/README.rst @@ -114,6 +114,7 @@ Contributors * Aaron Henriquez * Lois Rilo * Bhavesh Odedra +* Akim Juillerat Maintainer ---------- diff --git a/rma/models/rma_operation.py b/rma/models/rma_operation.py index bee15958..cee0ecc8 100644 --- a/rma/models/rma_operation.py +++ b/rma/models/rma_operation.py @@ -45,12 +45,12 @@ class RmaOperation(models.Model): in_route_id = fields.Many2one( comodel_name='stock.location.route', string='Inbound Route', domain=[('rma_selectable', '=', True)], - default=_default_routes, + default=lambda self: self._default_routes(), ) out_route_id = fields.Many2one( comodel_name='stock.location.route', string='Outbound Route', domain=[('rma_selectable', '=', True)], - default=_default_routes, + default=lambda self: self._default_routes(), ) customer_to_supplier = fields.Boolean( string='The customer will send to the supplier', @@ -60,10 +60,12 @@ class RmaOperation(models.Model): ) in_warehouse_id = fields.Many2one( comodel_name='stock.warehouse', string='Inbound Warehouse', - default=_default_warehouse_id) + default=lambda self: self._default_warehouse_id(), + ) out_warehouse_id = fields.Many2one( comodel_name='stock.warehouse', string='Outbound Warehouse', - default=_default_warehouse_id) + default=lambda self: self._default_warehouse_id(), + ) location_id = fields.Many2one( 'stock.location', 'Send To This Company Location') type = fields.Selection([ diff --git a/rma/models/rma_order.py b/rma/models/rma_order.py index 54134542..420006ab 100644 --- a/rma/models/rma_order.py +++ b/rma/models/rma_order.py @@ -50,12 +50,15 @@ class RmaOrder(models.Model): string='Group Number', index=True, copy=False) type = fields.Selection( [('customer', 'Customer'), ('supplier', 'Supplier')], - string="Type", required=True, default=_get_default_type, readonly=True) + string="Type", required=True, + default=lambda self: self._get_default_type(), + readonly=True + ) reference = fields.Char(string='Partner Reference', help="The partner reference of this RMA order.") comment = fields.Text('Additional Information') date_rma = fields.Datetime(string='Order Date', index=True, - default=_default_date_rma) + default=lambda self: self._default_date_rma(),) partner_id = fields.Many2one( comodel_name='res.partner', string='Partner', required=True) rma_line_ids = fields.One2many('rma.order.line', 'rma_id', diff --git a/rma/models/rma_order_line.py b/rma/models/rma_order_line.py index 221543f2..2c22dd98 100644 --- a/rma/models/rma_order_line.py +++ b/rma/models/rma_order_line.py @@ -167,7 +167,7 @@ class RmaOrderLine(models.Model): delivery_address_id = fields.Many2one( comodel_name='res.partner', string='Partner delivery address', - default=_default_delivery_address, + default=lambda self: self._default_delivery_address(), readonly=True, states={'draft': [('readonly', False)]}, help="This address will be used to deliver repaired or replacement " "products.", @@ -258,7 +258,8 @@ class RmaOrderLine(models.Model): default=lambda self: self.env.user.company_id) type = fields.Selection( selection=[('customer', 'Customer'), ('supplier', 'Supplier')], - string="Type", required=True, default=_get_default_type, + string="Type", required=True, + default=lambda self: self._get_default_type(), readonly=True, ) customer_to_supplier = fields.Boolean( @@ -298,19 +299,19 @@ class RmaOrderLine(models.Model): string='Inbound Warehouse', required=True, readonly=True, states={'draft': [('readonly', False)]}, - default=_default_warehouse_id, + default=lambda self: self._default_warehouse_id(), ) out_warehouse_id = fields.Many2one( comodel_name='stock.warehouse', string='Outbound Warehouse', required=True, readonly=True, states={'draft': [('readonly', False)]}, - default=_default_warehouse_id, + default=lambda self: self._default_warehouse_id(), ) location_id = fields.Many2one( comodel_name='stock.location', string='Send To This Company Location', required=True, readonly=True, states={'draft': [('readonly', False)]}, - default=_default_location_id, + default=lambda self: self._default_location_id(), ) customer_rma_id = fields.Many2one( 'rma.order.line', string='Customer RMA line', ondelete='cascade')