mirror of
https://github.com/ForgeFlow/stock-rma.git
synced 2025-01-21 12:57:49 +02:00
Proxy fields defaults with lambda to allow inheritance
This commit is contained in:
committed by
ahenriquez
parent
4b30d8c0ba
commit
450b8a2b49
@@ -114,6 +114,7 @@ Contributors
|
|||||||
* Aaron Henriquez <ahenriquez@eficent.com>
|
* Aaron Henriquez <ahenriquez@eficent.com>
|
||||||
* Lois Rilo <lois.rilo@eficent.com>
|
* Lois Rilo <lois.rilo@eficent.com>
|
||||||
* Bhavesh Odedra <bodedra@opensourceintegrators.com>
|
* Bhavesh Odedra <bodedra@opensourceintegrators.com>
|
||||||
|
* Akim Juillerat <akim.juillerat@camptocamp.com>
|
||||||
|
|
||||||
Maintainer
|
Maintainer
|
||||||
----------
|
----------
|
||||||
|
|||||||
@@ -45,12 +45,12 @@ class RmaOperation(models.Model):
|
|||||||
in_route_id = fields.Many2one(
|
in_route_id = fields.Many2one(
|
||||||
comodel_name='stock.location.route', string='Inbound Route',
|
comodel_name='stock.location.route', string='Inbound Route',
|
||||||
domain=[('rma_selectable', '=', True)],
|
domain=[('rma_selectable', '=', True)],
|
||||||
default=_default_routes,
|
default=lambda self: self._default_routes(),
|
||||||
)
|
)
|
||||||
out_route_id = fields.Many2one(
|
out_route_id = fields.Many2one(
|
||||||
comodel_name='stock.location.route', string='Outbound Route',
|
comodel_name='stock.location.route', string='Outbound Route',
|
||||||
domain=[('rma_selectable', '=', True)],
|
domain=[('rma_selectable', '=', True)],
|
||||||
default=_default_routes,
|
default=lambda self: self._default_routes(),
|
||||||
)
|
)
|
||||||
customer_to_supplier = fields.Boolean(
|
customer_to_supplier = fields.Boolean(
|
||||||
string='The customer will send to the supplier',
|
string='The customer will send to the supplier',
|
||||||
@@ -60,10 +60,12 @@ class RmaOperation(models.Model):
|
|||||||
)
|
)
|
||||||
in_warehouse_id = fields.Many2one(
|
in_warehouse_id = fields.Many2one(
|
||||||
comodel_name='stock.warehouse', string='Inbound Warehouse',
|
comodel_name='stock.warehouse', string='Inbound Warehouse',
|
||||||
default=_default_warehouse_id)
|
default=lambda self: self._default_warehouse_id(),
|
||||||
|
)
|
||||||
out_warehouse_id = fields.Many2one(
|
out_warehouse_id = fields.Many2one(
|
||||||
comodel_name='stock.warehouse', string='Outbound Warehouse',
|
comodel_name='stock.warehouse', string='Outbound Warehouse',
|
||||||
default=_default_warehouse_id)
|
default=lambda self: self._default_warehouse_id(),
|
||||||
|
)
|
||||||
location_id = fields.Many2one(
|
location_id = fields.Many2one(
|
||||||
'stock.location', 'Send To This Company Location')
|
'stock.location', 'Send To This Company Location')
|
||||||
type = fields.Selection([
|
type = fields.Selection([
|
||||||
|
|||||||
@@ -50,12 +50,15 @@ class RmaOrder(models.Model):
|
|||||||
string='Group Number', index=True, copy=False)
|
string='Group Number', index=True, copy=False)
|
||||||
type = fields.Selection(
|
type = fields.Selection(
|
||||||
[('customer', 'Customer'), ('supplier', 'Supplier')],
|
[('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',
|
reference = fields.Char(string='Partner Reference',
|
||||||
help="The partner reference of this RMA order.")
|
help="The partner reference of this RMA order.")
|
||||||
comment = fields.Text('Additional Information')
|
comment = fields.Text('Additional Information')
|
||||||
date_rma = fields.Datetime(string='Order Date', index=True,
|
date_rma = fields.Datetime(string='Order Date', index=True,
|
||||||
default=_default_date_rma)
|
default=lambda self: self._default_date_rma(),)
|
||||||
partner_id = fields.Many2one(
|
partner_id = fields.Many2one(
|
||||||
comodel_name='res.partner', string='Partner', required=True)
|
comodel_name='res.partner', string='Partner', required=True)
|
||||||
rma_line_ids = fields.One2many('rma.order.line', 'rma_id',
|
rma_line_ids = fields.One2many('rma.order.line', 'rma_id',
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ class RmaOrderLine(models.Model):
|
|||||||
|
|
||||||
delivery_address_id = fields.Many2one(
|
delivery_address_id = fields.Many2one(
|
||||||
comodel_name='res.partner', string='Partner delivery address',
|
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)]},
|
readonly=True, states={'draft': [('readonly', False)]},
|
||||||
help="This address will be used to deliver repaired or replacement "
|
help="This address will be used to deliver repaired or replacement "
|
||||||
"products.",
|
"products.",
|
||||||
@@ -258,7 +258,8 @@ class RmaOrderLine(models.Model):
|
|||||||
default=lambda self: self.env.user.company_id)
|
default=lambda self: self.env.user.company_id)
|
||||||
type = fields.Selection(
|
type = fields.Selection(
|
||||||
selection=[('customer', 'Customer'), ('supplier', 'Supplier')],
|
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,
|
readonly=True,
|
||||||
)
|
)
|
||||||
customer_to_supplier = fields.Boolean(
|
customer_to_supplier = fields.Boolean(
|
||||||
@@ -298,19 +299,19 @@ class RmaOrderLine(models.Model):
|
|||||||
string='Inbound Warehouse',
|
string='Inbound Warehouse',
|
||||||
required=True,
|
required=True,
|
||||||
readonly=True, states={'draft': [('readonly', False)]},
|
readonly=True, states={'draft': [('readonly', False)]},
|
||||||
default=_default_warehouse_id,
|
default=lambda self: self._default_warehouse_id(),
|
||||||
)
|
)
|
||||||
out_warehouse_id = fields.Many2one(
|
out_warehouse_id = fields.Many2one(
|
||||||
comodel_name='stock.warehouse', string='Outbound Warehouse',
|
comodel_name='stock.warehouse', string='Outbound Warehouse',
|
||||||
required=True,
|
required=True,
|
||||||
readonly=True, states={'draft': [('readonly', False)]},
|
readonly=True, states={'draft': [('readonly', False)]},
|
||||||
default=_default_warehouse_id,
|
default=lambda self: self._default_warehouse_id(),
|
||||||
)
|
)
|
||||||
location_id = fields.Many2one(
|
location_id = fields.Many2one(
|
||||||
comodel_name='stock.location', string='Send To This Company Location',
|
comodel_name='stock.location', string='Send To This Company Location',
|
||||||
required=True,
|
required=True,
|
||||||
readonly=True, states={'draft': [('readonly', False)]},
|
readonly=True, states={'draft': [('readonly', False)]},
|
||||||
default=_default_location_id,
|
default=lambda self: self._default_location_id(),
|
||||||
)
|
)
|
||||||
customer_rma_id = fields.Many2one(
|
customer_rma_id = fields.Many2one(
|
||||||
'rma.order.line', string='Customer RMA line', ondelete='cascade')
|
'rma.order.line', string='Customer RMA line', ondelete='cascade')
|
||||||
|
|||||||
Reference in New Issue
Block a user