mirror of
https://github.com/OCA/rma.git
synced 2025-02-16 17:11:47 +02:00
[FIX] [no task] Fix linting issues
This commit is contained in:
committed by
Holger Brunn
parent
fa96d0cbfd
commit
942875ea53
@@ -1,13 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data noupdate="1">
|
||||
<record id="categ_claim10" model="crm.case.categ">
|
||||
<record id="categ_claim10" model="crm.case.categ">
|
||||
<field name="name">No Inventory</field>
|
||||
<field name="section_id" ref="section_after_sales_service"/>
|
||||
<field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
|
||||
</record>
|
||||
|
||||
<record id="categ_claim11" model="crm.case.categ">
|
||||
<record id="categ_claim11" model="crm.case.categ">
|
||||
<field name="name">Customer Return</field>
|
||||
<field name="section_id" ref="section_after_sales_service"/>
|
||||
<field name="object_id" search="[('model','=','crm.claim')]" model="ir.model"/>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data noupdate="1">
|
||||
<record id="section_after_sales_service" model="crm.case.section">
|
||||
<record id="section_after_sales_service" model="crm.case.section">
|
||||
<field name="name">After Sales Service</field>
|
||||
<field name="code">ASV</field>
|
||||
<field name="parent_id" ref="sales_team.section_sales_department"/>
|
||||
|
||||
@@ -89,7 +89,7 @@ class ClaimLine(models.Model):
|
||||
('2_high', 'High'),
|
||||
('3_very_high', 'Very High')],
|
||||
'Priority', default='0_not_define',
|
||||
compute='_set_priority',
|
||||
compute='_compute_set_priority',
|
||||
store=True,
|
||||
readonly=False,
|
||||
help="Priority attention of claim line")
|
||||
@@ -135,7 +135,7 @@ class ClaimLine(models.Model):
|
||||
warning = fields.Selection(WARRANT_COMMENT,
|
||||
'Warranty', readonly=True,
|
||||
help="If warranty has expired")
|
||||
display_name = fields.Char('Name', compute='_get_display_name')
|
||||
display_name = fields.Char('Name', compute='_compute_get_display_name')
|
||||
|
||||
@api.model
|
||||
def get_warranty_return_partner(self):
|
||||
@@ -220,7 +220,7 @@ class ClaimLine(models.Model):
|
||||
return super(ClaimLine, self).copy(default=std_default)
|
||||
|
||||
@api.depends('invoice_date', 'date')
|
||||
def _set_priority(self):
|
||||
def _compute_set_priority(self):
|
||||
"""
|
||||
To determine the priority of claim line
|
||||
"""
|
||||
@@ -429,7 +429,7 @@ class ClaimLine(models.Model):
|
||||
return res
|
||||
|
||||
@api.multi
|
||||
def _get_display_name(self):
|
||||
def _compute_get_display_name(self):
|
||||
for line_id in self:
|
||||
line_id.display_name = "%s - %s" % (
|
||||
line_id.claim_id.code, line_id.name)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
access_substate_user,substate.substate.user,model_substate_substate,base.group_sale_salesman_all_leads,1,1,1,0
|
||||
access_claim_line_user,claim.line.user,model_claim_line,base.group_sale_salesman_all_leads,1,1,1,0
|
||||
access_substate_user_salesman_all_leads,substate.substate.user,model_substate_substate,base.group_sale_salesman_all_leads,1,1,1,0
|
||||
access_claim_line_user_salesman_all_leads,claim.line.user,model_claim_line,base.group_sale_salesman_all_leads,1,1,1,0
|
||||
access_substate_manager,substate.substate.manager,model_substate_substate,base.group_sale_manager,1,1,1,1
|
||||
access_claim_line_manager,claim.line.manager,model_claim_line,base.group_sale_manager,1,1,1,1
|
||||
access_substate_user,substate.substate.user,model_substate_substate,base.group_sale_salesman,1,1,1,0
|
||||
access_claim_line_user,claim.line.user,model_claim_line,base.group_sale_salesman,1,1,1,0
|
||||
access_substate_user_salesman,substate.substate.user,model_substate_substate,base.group_sale_salesman,1,1,1,0
|
||||
access_claim_line_user_salesman,claim.line.user,model_claim_line,base.group_sale_salesman,1,1,1,0
|
||||
|
||||
|
@@ -21,6 +21,7 @@
|
||||
#
|
||||
##############################################################################
|
||||
from openerp.tests import common
|
||||
from openerp.tools import safe_eval
|
||||
|
||||
|
||||
class TestPickingCreation(common.TransactionCase):
|
||||
@@ -185,7 +186,7 @@ class TestPickingCreation(common.TransactionCase):
|
||||
|
||||
self.assertTrue(res)
|
||||
self.assertEquals(res['res_model'], 'account.invoice')
|
||||
self.assertEquals(eval(res['context'])['type'], 'out_refund')
|
||||
self.assertEquals(safe_eval(res['context'])['type'], 'out_refund')
|
||||
|
||||
def test_04_display_name(self):
|
||||
"""
|
||||
|
||||
@@ -63,6 +63,7 @@
|
||||
<field name="name">CRM - Claim product return Form</field>
|
||||
<field name="model">crm.claim</field>
|
||||
<field name="inherit_id" ref="crm_claim.crm_case_claims_form_view"/>
|
||||
<field name="priority">99</field>
|
||||
<field name="arch" type="xml">
|
||||
<!-- Header/workflow Buttons -->
|
||||
<xpath expr="//field[@name='stage_id']" position="before">
|
||||
|
||||
@@ -95,7 +95,7 @@ class TestCrmRmaLotMassReturn(TransactionCase):
|
||||
self.assertEqual(len(lines_list_id),
|
||||
int(self.invoice_id.invoice_line.quantity))
|
||||
|
||||
wizard_id._set_message()
|
||||
wizard_id._compute_set_message()
|
||||
|
||||
wizard_id.add_claim_lines()
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ class TestCrmRmaLotMassReturn2(TransactionCase):
|
||||
# Validate it has exactly as much records as the taken invoice has
|
||||
self.assertEqual(len(lines_list_id), int(qty))
|
||||
|
||||
wizard_id._set_message()
|
||||
wizard_id._compute_set_message()
|
||||
wizard_id.add_claim_lines()
|
||||
|
||||
# 2 Macs
|
||||
@@ -200,7 +200,7 @@ class TestCrmRmaLotMassReturn2(TransactionCase):
|
||||
wizard_id.lines_list_id = [(6, 0, [clw_id.id])]
|
||||
self.assertEqual(len(lines_list_id), 1)
|
||||
|
||||
wizard_id._set_message()
|
||||
wizard_id._compute_set_message()
|
||||
wizard_id.add_claim_lines()
|
||||
self.assertEqual(len(self.claim_id_2.claim_line_ids), 1)
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ class ClaimLineWizard(models.TransientModel):
|
||||
required=True,
|
||||
string="Invoice Line",
|
||||
help="Invoice Line")
|
||||
name = fields.Char(compute="_get_complete_name",
|
||||
name = fields.Char(compute="_compute_get_complete_name",
|
||||
string="Complete Lot Name",)
|
||||
|
||||
@api.constrains('product_id', 'invoice_line_id')
|
||||
@@ -47,14 +47,14 @@ class ClaimLineWizard(models.TransientModel):
|
||||
for record in self:
|
||||
if record.product_id != \
|
||||
record.invoice_line_id.product_id:
|
||||
raise ValidationError("The product of the"
|
||||
" invoice %s is not same"
|
||||
" that product %s" %
|
||||
raise ValidationError(_("The product of the"
|
||||
" invoice %s is not same"
|
||||
" that product %s" %
|
||||
(record.invoice_line_id.product_id.name,
|
||||
record.product_id.name))
|
||||
record.product_id.name)))
|
||||
|
||||
@api.depends('invoice_line_id', 'lot_id', 'product_id')
|
||||
def _get_complete_name(self):
|
||||
def _compute_get_complete_name(self):
|
||||
for wizard in self:
|
||||
invoice_number = wizard.invoice_line_id.invoice_id.number
|
||||
product_name = wizard.product_id.name
|
||||
@@ -534,14 +534,10 @@ class ReturnedLinesFromSerial(models.TransientModel):
|
||||
self.env[
|
||||
'claim.line']._get_subject(num),
|
||||
product_id, clw_id, 1, name)
|
||||
|
||||
# Clean items in wizard model
|
||||
if len(clw_ids) == 1:
|
||||
ids_to_delete = "(%s)" % str(clw_ids[0].id)
|
||||
else:
|
||||
ids_to_delete = "%s" % str(tuple([clw.id for clw in clw_ids]))
|
||||
self._cr.execute("DELETE FROM claim_line_wizard where id IN %s"
|
||||
% ids_to_delete)
|
||||
ids_to_delete = tuple([clw.id for clw in clw_ids])
|
||||
self._cr.execute(
|
||||
"DELETE FROM claim_line_wizard where id IN %s",
|
||||
(ids_to_delete, ))
|
||||
|
||||
# normal execution
|
||||
self.action_cancel()
|
||||
@@ -555,11 +551,11 @@ class ReturnedLinesFromSerial(models.TransientModel):
|
||||
}
|
||||
|
||||
message = fields.Text(string='Message',
|
||||
compute='_set_message'
|
||||
compute='_compute_set_message'
|
||||
)
|
||||
|
||||
@api.depends('current_status', 'lines_list_id', 'scan_data')
|
||||
def _set_message(self):
|
||||
def _compute_set_message(self):
|
||||
"""
|
||||
Notify for missing (not added) claim lines that are in use in others
|
||||
claims
|
||||
|
||||
@@ -31,11 +31,11 @@ class StockProductionLot(models.Model):
|
||||
help="Invoice Line Of "
|
||||
"Product to Customer Invoice")
|
||||
|
||||
lot_complete_name = fields.Char(compute="_get_lot_complete_name",
|
||||
lot_complete_name = fields.Char(compute="_compute_get_lot_complete_name",
|
||||
string="Complete Lot Name")
|
||||
|
||||
@api.depends('invoice_line_id', 'name')
|
||||
def _get_lot_complete_name(self):
|
||||
def _compute_get_lot_complete_name(self):
|
||||
name = _("%s - Lot Number: %s - %s") % \
|
||||
(self.invoice_line_id.invoice_id.number,
|
||||
self.name or _('No lot number'),
|
||||
|
||||
@@ -183,7 +183,7 @@ class TestCrmRmaProdLotInvoice(TransactionCase):
|
||||
'name': 'Lot for %s' % (purchase_order_id.name),
|
||||
'product_id': self.product_id.id,
|
||||
})
|
||||
lot_id._get_lot_complete_name()
|
||||
lot_id._compute_get_lot_complete_name()
|
||||
|
||||
self.do_whole_transfer_process(
|
||||
lot_id=lot_id,
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from openerp import _, api, fields, models
|
||||
from openerp import api, fields, models
|
||||
import openerp.addons.decimal_precision as dp
|
||||
from openerp.tools.float_utils import float_round
|
||||
from openerp.tools.safe_eval import safe_eval as eval
|
||||
@@ -30,16 +30,16 @@ class ProductProduct(models.Model):
|
||||
_inherit = 'product.product'
|
||||
|
||||
rma_qty_available = fields.Float(
|
||||
compute='_rma_product_available',
|
||||
compute='_compute_rma_product_available',
|
||||
digits_compute=dp.get_precision('Product Unit of Measure'),
|
||||
search='_search_rma_product_quantity',
|
||||
string=_('RMA Quantity On Hand'))
|
||||
string='RMA Quantity On Hand')
|
||||
|
||||
rma_virtual_available = fields.Float(
|
||||
compute='_rma_product_available',
|
||||
compute='_compute_rma_product_available',
|
||||
digits_compute=dp.get_precision('Product Unit of Measure'),
|
||||
search='_search_rma_product_quantity',
|
||||
string=_('RMA Forecasted Quantity'))
|
||||
string='RMA Forecasted Quantity')
|
||||
|
||||
def _search_rma_product_quantity(self, operator, value):
|
||||
res = []
|
||||
@@ -65,7 +65,7 @@ class ProductProduct(models.Model):
|
||||
return res
|
||||
|
||||
@api.multi
|
||||
def _rma_product_available(self):
|
||||
def _compute_rma_product_available(self):
|
||||
"""
|
||||
Finds the incoming and outgoing quantity of product for the RMA
|
||||
locations.
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from openerp import _, api, fields, models
|
||||
from openerp import api, fields, models
|
||||
import openerp.addons.decimal_precision as dp
|
||||
|
||||
|
||||
@@ -29,20 +29,20 @@ class ProductTemplate(models.Model):
|
||||
|
||||
_inherit = 'product.template'
|
||||
|
||||
rma_qty_available = fields.Float(compute='_rma_template_available',
|
||||
digits_compute=dp.
|
||||
get_precision('Product Unit '
|
||||
'of Measure'),
|
||||
string=_('RMA Quantity On Hand'))
|
||||
rma_qty_available = fields.Float(
|
||||
compute='_compute_rma_template_available',
|
||||
digits_compute=dp.get_precision('Product Unit of Measure'),
|
||||
string='RMA Quantity On Hand',
|
||||
)
|
||||
|
||||
rma_virtual_available = fields.Float(compute='_rma_template_available',
|
||||
digits_compute=dp.
|
||||
get_precision('Product Unit'
|
||||
' of Measure'),
|
||||
string=_('RMA Forecasted Quantity'))
|
||||
rma_virtual_available = fields.Float(
|
||||
compute='_compute_rma_template_available',
|
||||
digits_compute=dp.get_precision('Product Unit of Measure'),
|
||||
string='RMA Forecasted Quantity',
|
||||
)
|
||||
|
||||
@api.multi
|
||||
def _rma_template_available(self):
|
||||
def _compute_rma_template_available(self):
|
||||
for product in self:
|
||||
product.rma_qty_available = sum(
|
||||
product.mapped('product_variant_ids.rma_virtual_available'))
|
||||
|
||||
@@ -23,6 +23,7 @@ from openerp.tests.common import TransactionCase
|
||||
|
||||
|
||||
class TestCrmRmaStockLocation(TransactionCase):
|
||||
post_install = True
|
||||
|
||||
def setUp(self):
|
||||
super(TestCrmRmaStockLocation, self).setUp()
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from openerp.tools.safe_eval import safe_eval
|
||||
from openerp.tests.common import TransactionCase
|
||||
|
||||
|
||||
@@ -133,9 +133,10 @@ class TestPickingFromPicking(TransactionCase):
|
||||
}
|
||||
wizard_id = self.wizardmakepicking.with_context(new_context).create({})
|
||||
|
||||
default_location_dest_id = eval(
|
||||
default_location_dest_id = safe_eval(
|
||||
'self.claim_id.warehouse_id.'
|
||||
'rma_%s_type_id.default_location_dest_id' % picking_type_str)
|
||||
'rma_%s_type_id.default_location_dest_id' % picking_type_str,
|
||||
{'self': self})
|
||||
self.assertEquals(
|
||||
wizard_id.claim_line_dest_location_id, default_location_dest_id)
|
||||
|
||||
@@ -153,7 +154,8 @@ class TestPickingFromPicking(TransactionCase):
|
||||
}
|
||||
wizard_id = self.wizardmakepicking.with_context(new_context).create({})
|
||||
|
||||
default_location_dest_id = eval(
|
||||
'self.claim_id.warehouse_id.loss_loc_id')
|
||||
default_location_dest_id = safe_eval(
|
||||
'self.claim_id.warehouse_id.loss_loc_id',
|
||||
{'self': self})
|
||||
self.assertEquals(
|
||||
wizard_id.claim_line_dest_location_id, default_location_dest_id)
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from openerp import _, models, fields, api
|
||||
from openerp import models, fields, api
|
||||
from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT
|
||||
from openerp import workflow
|
||||
import time
|
||||
@@ -82,12 +82,12 @@ class ClaimMakePickingFromPicking(models.TransientModel):
|
||||
return loc_id
|
||||
|
||||
picking_line_source_location = fields.Many2one(
|
||||
'stock.location', _('Source Location'),
|
||||
help=_("Source location where the returned products are"),
|
||||
'stock.location', 'Source Location',
|
||||
help="Source location where the returned products are",
|
||||
required=True, default=_get_source_loc)
|
||||
picking_line_dest_location = fields.Many2one(
|
||||
'stock.location', _('Dest. Location'),
|
||||
help=_("Target location to send returned products"),
|
||||
'stock.location', 'Dest. Location',
|
||||
help="Target location to send returned products",
|
||||
required=True, default=_get_dest_loc)
|
||||
picking_line_ids = fields.Many2many(
|
||||
'stock.move', 'claim_picking_line_picking', 'claim_picking_id',
|
||||
|
||||
@@ -39,6 +39,5 @@
|
||||
],
|
||||
'test': [],
|
||||
'installable': True,
|
||||
'active': False,
|
||||
'images': ['images/product_warranty.png'],
|
||||
}
|
||||
|
||||
@@ -43,26 +43,25 @@ class ProductSupplierInfo(models.Model):
|
||||
.search([('is_default', '=', True)], limit=1)
|
||||
return instruction_ids
|
||||
|
||||
@api.one
|
||||
@api.multi
|
||||
@api.depends('warranty_return_partner')
|
||||
def _compute_warranty_return_address(self):
|
||||
""" Method to return the partner delivery address or if none, the
|
||||
default address
|
||||
"""
|
||||
return_partner = self.warranty_return_partner
|
||||
partner_id = self.company_id.partner_id.id
|
||||
if return_partner:
|
||||
if return_partner == 'supplier':
|
||||
partner_id = self.name.id
|
||||
elif return_partner == 'company':
|
||||
if self.company_id.crm_return_address_id:
|
||||
partner_id = self.company_id.\
|
||||
crm_return_address_id.id
|
||||
elif return_partner == 'other':
|
||||
if self.warranty_return_other_address:
|
||||
partner_id = self.\
|
||||
warranty_return_other_address.id
|
||||
self.warranty_return_address = partner_id
|
||||
for rec in self:
|
||||
return_partner = rec.warranty_return_partner
|
||||
partner_id = rec.company_id.partner_id.id
|
||||
if return_partner:
|
||||
if return_partner == 'supplier':
|
||||
partner_id = rec.name.id
|
||||
elif return_partner == 'company':
|
||||
if rec.company_id.crm_return_address_id:
|
||||
partner_id = rec.company_id.crm_return_address_id.id
|
||||
elif return_partner == 'other':
|
||||
if rec.warranty_return_other_address:
|
||||
partner_id = rec.warranty_return_other_address.id
|
||||
rec.warranty_return_address = partner_id
|
||||
|
||||
warranty_duration = fields.Float(
|
||||
'Period',
|
||||
|
||||
@@ -45,6 +45,7 @@ class TestProductWarranty(TransactionCase):
|
||||
min_qty=4,
|
||||
delay=5,
|
||||
warranty_return_partner='supplier',
|
||||
warranty_return_other_address=partner_id.id,
|
||||
product_tmpl_id=product_tmpl_id.id,)
|
||||
self.supplierinfo_brw = \
|
||||
self.supplierinfo.create(supplierinfo_data)
|
||||
@@ -78,3 +79,8 @@ class TestProductWarranty(TransactionCase):
|
||||
self.assertEquals(self.supplierinfo_brw.warranty_return_address.id,
|
||||
self.supplierinfo_brw.company_id.
|
||||
crm_return_address_id.id)
|
||||
|
||||
self.supplierinfo_brw.write({'warranty_return_partner': 'other'})
|
||||
self.assertEquals(
|
||||
self.supplierinfo_brw.warranty_return_address.id,
|
||||
self.supplierinfo_brw.warranty_return_other_address.id)
|
||||
|
||||
Reference in New Issue
Block a user