adjust PEP8 syntax

This commit is contained in:
bima
2017-06-02 16:31:22 +07:00
parent d3ba3dfbff
commit 8ac4baed4c
2 changed files with 16 additions and 7 deletions

View File

@@ -8,7 +8,8 @@ from odoo import api, fields, models
class MrpProduction(models.Model):
_inherit = "mrp.production"
sale_id = fields.Many2one('sale.order', compute='_compute_sale_info', string='Sale order',
sale_id = fields.Many2one('sale.order', compute='_compute_sale_info',
string='Sale order',
readonly=True)
partner_id = fields.Many2one('res.partner', compute='_compute_sale_info',
string='Customer')
@@ -24,7 +25,11 @@ class MrpProduction(models.Model):
for production in self:
move = get_parent_move(production.move_finished_ids)
production.sale_id = move.procurement_id and move.procurement_id.sale_line_id and \
move.procurement_id.sale_line_id.order_id.id or False
production.partner_id = production.sale_id and production.sale_id.partner_id and production.sale_id.partner_id.id or False
production.commitment_date = production.sale_id and production.sale_id.commitment_date or ''
proc = move.procurement_id
production.sale_id = proc and proc.sale_line_id and \
proc.sale_line_id.order_id.id or False
production.partner_id = production.sale_id and \
production.sale_id.partner_id and \
production.sale_id.partner_id.id or False
production.commitment_date = production.sale_id and \
production.sale_id.commitment_date or ''

View File

@@ -24,13 +24,17 @@ class TestManufactureSale(TransactionCase):
'partner_id': self.partner.id,
'partner_invoice_id': self.partner.id,
'partner_shipping_id': self.partner.id,
'order_line': [(0, 0, {'name': product.name, 'product_id': product.id, 'product_uom_qty': 1, 'product_uom': product.uom_id.id,
'order_line': [(0, 0, {'name': product.name,
'product_id': product.id,
'product_uom_qty': 1,
'product_uom': product.uom_id.id,
'price_unit': product.list_price})
],
'pricelist_id': self.env.ref('product.list0').id,
})
so.action_confirm()
mrp = self.mrp_production.search([('origin', 'like', so.name+'%')], limit=1)
mrp = self.mrp_production.search([('origin', 'like', so.name+'%')],
limit=1)
# checking sale info filled correctly on manufacture
self.assertEqual(so.id, mrp.sale_id.id)
self.assertEqual(self.partner.id, mrp.partner_id.id)