diff --git a/contract_sale/models/contract.py b/contract_sale/models/contract.py index b4329a91..3a3af61c 100644 --- a/contract_sale/models/contract.py +++ b/contract_sale/models/contract.py @@ -23,7 +23,7 @@ class ContractContract(models.Model): continue invoice_values = contract._prepare_invoice(date_ref) - #Search Contract in sale order + # Search Contract in sale order order_ids = self.env['sale.order'].search([ ('partner_id', '=', contract.partner_id.id), ('contract_id', '=', contract.id), @@ -36,13 +36,16 @@ class ContractContract(models.Model): ) if invoice_line_values: - #Check Invoice and If It's Not Created then Updated Qty + # Check Invoice and If It's Not Created then Updated Qty for order_id in order_ids: - invoice_ids = order_id.order_line.mapped('invoice_lines') + invoice_ids =\ + order_id.order_line.mapped('invoice_lines') if not invoice_ids: for line in order_id.order_line: - if line.product_id.id == invoice_line_values.get('product_id', False): - invoice_line_values['quantity'] += line.product_uom_qty + if line.product_id.id == invoice_line_values.\ + get('product_id', False): + invoice_line_values['quantity' + ] += line.product_uom_qty invoice_values['invoice_line_ids'].append( (0, 0, invoice_line_values) diff --git a/contract_sale/models/sale_order.py b/contract_sale/models/sale_order.py index b2a5b9c4..2abd1d71 100644 --- a/contract_sale/models/sale_order.py +++ b/contract_sale/models/sale_order.py @@ -1,5 +1,5 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import api, fields, models +from odoo import fields, models class SaleOrder(models.Model):