mirror of
https://github.com/ForgeFlow/stock-rma.git
synced 2025-01-21 12:57:49 +02:00
[IMP] default operation in product and product_categ for customer and supplier
[IMP]Separate menus for customer and supplier operations * Add active field to rma operation * Added tests * Fix travis * Fix create supplier rma from customer rma
This commit is contained in:
committed by
JasminSForgeFlow
parent
5ffc2ab326
commit
d056a3c323
@@ -1,7 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# © 2017 Eficent Business and IT Consulting Services S.L.
|
# © 2017 Eficent Business and IT Consulting Services S.L.
|
||||||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
|
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
|
||||||
from openerp import _, api, fields, models
|
from openerp import fields, models
|
||||||
|
|
||||||
|
|
||||||
class RmaOperation(models.Model):
|
class RmaOperation(models.Model):
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# © 2017 Eficent Business and IT Consulting Services S.L.
|
# © 2017 Eficent Business and IT Consulting Services S.L.
|
||||||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
|
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
|
||||||
from openerp import _, api, fields, models
|
from openerp import api, fields, models
|
||||||
from openerp.addons import decimal_precision as dp
|
|
||||||
|
|
||||||
|
|
||||||
class RmaOrder(models.Model):
|
class RmaOrder(models.Model):
|
||||||
_inherit = "rma.order"
|
_inherit = "rma.order"
|
||||||
|
|
||||||
@api.one
|
@api.multi
|
||||||
def _compute_sales_count(self):
|
def _compute_sales_count(self):
|
||||||
|
self.ensure_one()
|
||||||
sales_list = []
|
sales_list = []
|
||||||
for rma_line in self.rma_line_ids:
|
for rma_line in self.rma_line_ids:
|
||||||
if rma_line.sale_line_id and rma_line.sale_line_id.id:
|
if rma_line.sale_line_id and rma_line.sale_line_id.id:
|
||||||
|
|||||||
@@ -1,22 +1,13 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# © 2017 Eficent Business and IT Consulting Services S.L.
|
# © 2017 Eficent Business and IT Consulting Services S.L.
|
||||||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
|
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
|
||||||
from openerp import _, api, fields, models
|
from openerp import api, fields, models
|
||||||
from openerp.addons import decimal_precision as dp
|
from openerp.addons import decimal_precision as dp
|
||||||
|
|
||||||
|
|
||||||
class RmaOrderLine(models.Model):
|
class RmaOrderLine(models.Model):
|
||||||
_inherit = "rma.order.line"
|
_inherit = "rma.order.line"
|
||||||
|
|
||||||
@api.model
|
|
||||||
def _default_sale_type(self):
|
|
||||||
return self.sale_type or False
|
|
||||||
|
|
||||||
sale_type = fields.Selection([
|
|
||||||
('no', 'Not required'), ('ordered', 'Based on Ordered Quantities'),
|
|
||||||
('received', 'Based on Received Quantities')],
|
|
||||||
string="Sale Policy", default=_default_sale_type)
|
|
||||||
|
|
||||||
@api.one
|
@api.one
|
||||||
@api.depends('sale_line_ids', 'sale_type', 'sales_count',
|
@api.depends('sale_line_ids', 'sale_type', 'sales_count',
|
||||||
'sale_line_ids.state')
|
'sale_line_ids.state')
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
# © 2017 Eficent Business and IT Consulting Services S.L.
|
# © 2017 Eficent Business and IT Consulting Services S.L.
|
||||||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
|
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
|
||||||
|
|
||||||
from openerp import _, api, fields, models
|
from openerp import api, fields, models
|
||||||
from openerp.exceptions import ValidationError
|
from openerp.exceptions import ValidationError
|
||||||
|
|
||||||
|
|
||||||
@@ -43,10 +43,10 @@ class RmaAddSale(models.TransientModel):
|
|||||||
|
|
||||||
def _prepare_rma_line_from_sale_order_line(self, line):
|
def _prepare_rma_line_from_sale_order_line(self, line):
|
||||||
operation = line.product_id.rma_operation_id and \
|
operation = line.product_id.rma_operation_id and \
|
||||||
line.product_id.rma_operation_id.id or False
|
line.product_id.rma_operation_id.id or False
|
||||||
if not operation:
|
if not operation:
|
||||||
operation = line.product_id.categ_id.rma_operation_id and \
|
operation = line.product_id.categ_id.rma_operation_id and \
|
||||||
line.product_id.categ_id.rma_operation_id.id or False
|
line.product_id.categ_id.rma_operation_id.id or False
|
||||||
data = {
|
data = {
|
||||||
'sale_line_id': line.id,
|
'sale_line_id': line.id,
|
||||||
'product_id': line.product_id.id,
|
'product_id': line.product_id.id,
|
||||||
@@ -74,8 +74,8 @@ class RmaAddSale(models.TransientModel):
|
|||||||
{'in_route_id': operation.in_route_id.id or route,
|
{'in_route_id': operation.in_route_id.id or route,
|
||||||
'out_route_id': operation.out_route_id.id or route,
|
'out_route_id': operation.out_route_id.id or route,
|
||||||
'receipt_policy': operation.receipt_policy,
|
'receipt_policy': operation.receipt_policy,
|
||||||
'location_id': operation.location_id.id or
|
'location_id': operation.location_id.id or self.env.ref(
|
||||||
self.env.ref('stock.stock_location_stock').id,
|
'stock.stock_location_stock').id,
|
||||||
'operation_id': operation.id,
|
'operation_id': operation.id,
|
||||||
'refund_policy': operation.refund_policy,
|
'refund_policy': operation.refund_policy,
|
||||||
'delivery_policy': operation.delivery_policy
|
'delivery_policy': operation.delivery_policy
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# © 2017 Eficent Business and IT Consulting Services S.L.
|
# © 2017 Eficent Business and IT Consulting Services S.L.
|
||||||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
|
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
|
||||||
from openerp import _, api, fields, models
|
from openerp import api, fields, models
|
||||||
|
|
||||||
|
|
||||||
class RmaRefund(models.TransientModel):
|
class RmaRefund(models.TransientModel):
|
||||||
|
|||||||
Reference in New Issue
Block a user