From e094d5ada00c249d8cc0ace7a2f81501cae481a5 Mon Sep 17 00:00:00 2001 From: Guewen Baconnier Date: Mon, 8 Sep 2014 14:04:13 +0200 Subject: [PATCH] pep8 in crm_claim_rma --- crm_claim_rma/crm_claim_rma.py | 6 +++--- crm_claim_rma/tests/test_lp_1282584.py | 10 +++++++--- crm_claim_rma/wizard/claim_make_picking.py | 5 +++-- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/crm_claim_rma/crm_claim_rma.py b/crm_claim_rma/crm_claim_rma.py index a43550e8..824b26a8 100644 --- a/crm_claim_rma/crm_claim_rma.py +++ b/crm_claim_rma/crm_claim_rma.py @@ -313,7 +313,7 @@ class claim_line(orm.Model): claim_id, company_id, warehouse_id, claim_type, claim_date, context=None): if not claim_id and not (company_id and warehouse_id and - claim_type and claim_date): + claim_type and claim_date): # if we have a claim_id, we get the info from there, # otherwise we get it from the args (on creation typically) return {} @@ -421,7 +421,8 @@ class crm_claim(orm.Model): def init(self, cr): cr.execute(""" - UPDATE "crm_claim" SET "number"=id::varchar WHERE ("number" is NULL) + UPDATE "crm_claim" SET "number"=id::varchar + WHERE ("number" is NULL) OR ("number" = '/'); """) @@ -558,7 +559,6 @@ class crm_claim(orm.Model): invoice_lines = invoice_line_obj.browse(cr, uid, invoice_line_ids, context=context) - def warranty_values(invoice, product): values = {} try: diff --git a/crm_claim_rma/tests/test_lp_1282584.py b/crm_claim_rma/tests/test_lp_1282584.py index c3cd36ff..d9e21500 100644 --- a/crm_claim_rma/tests/test_lp_1282584.py +++ b/crm_claim_rma/tests/test_lp_1282584.py @@ -78,7 +78,8 @@ class test_lp_1282584(common.TransactionCase): res = self.WizardMakePicking.action_create_picking( cr, uid, [wizard_id], context=wiz_context) - self.assertEquals(res.get('res_model'), 'stock.picking.in', "Wrong model defined") + self.assertEquals(res.get('res_model'), 'stock.picking.in', + "Wrong model defined") def test_01(self): """Test wizard opened view model for a new delivery @@ -92,7 +93,9 @@ class test_lp_1282584(common.TransactionCase): wizard_chg_qty_id = WizardChangeProductQty.create(cr, uid, { 'product_id': self.product_id, 'new_quantity': 12}) - WizardChangeProductQty.change_product_qty(cr, uid, [wizard_chg_qty_id], context=wiz_context) + WizardChangeProductQty.change_product_qty(cr, uid, + [wizard_chg_qty_id], + context=wiz_context) wiz_context = { 'active_id': self.claim_id, @@ -105,4 +108,5 @@ class test_lp_1282584(common.TransactionCase): res = self.WizardMakePicking.action_create_picking( cr, uid, [wizard_id], context=wiz_context) - self.assertEquals(res.get('res_model'), 'stock.picking.out', "Wrong model defined") + self.assertEquals(res.get('res_model'), 'stock.picking.out', + "Wrong model defined") diff --git a/crm_claim_rma/wizard/claim_make_picking.py b/crm_claim_rma/wizard/claim_make_picking.py index fb97602a..3acd8faa 100644 --- a/crm_claim_rma/wizard/claim_make_picking.py +++ b/crm_claim_rma/wizard/claim_make_picking.py @@ -223,14 +223,15 @@ class claim_make_picking(orm.TransientModel): }, context=context) # Create picking lines + fmt = DEFAULT_SERVER_DATETIME_FORMAT for wizard_claim_line in wizard.claim_line_ids: move_obj = self.pool.get('stock.move') move_id = move_obj.create( cr, uid, {'name': wizard_claim_line.product_id.name_template, 'priority': '0', - 'date': time.strftime(DEFAULT_SERVER_DATETIME_FORMAT), - 'date_expected': time.strftime(DEFAULT_SERVER_DATETIME_FORMAT), + 'date': time.strftime(fmt), + 'date_expected': time.strftime(fmt), 'product_id': wizard_claim_line.product_id.id, 'product_qty': wizard_claim_line.product_returned_quantity, 'product_uom': wizard_claim_line.product_id.uom_id.id,