[IMP] pre-commit: first run on whole repo

This commit is contained in:
Kevin Khao
2021-11-26 18:54:38 +03:00
parent a04b8980e1
commit 167aefee13
289 changed files with 6020 additions and 4170 deletions

View File

@@ -6,7 +6,7 @@ from odoo import fields, models
class ProductTemplate(models.Model):
_inherit = 'product.template'
_inherit = "product.template"
purchase_method = fields.Selection(tracking=True)
purchase_line_warn = fields.Selection(tracking=True)

View File

@@ -7,7 +7,7 @@ from odoo.tools.misc import formatLang
class PurchaseOrder(models.Model):
_inherit = 'purchase.order'
_inherit = "purchase.order"
dest_address_id = fields.Many2one(tracking=True)
currency_id = fields.Many2one(tracking=True)
@@ -17,24 +17,26 @@ class PurchaseOrder(models.Model):
# the field 'delivery_partner_id' is used in report
# the compute method of that field is inherited in purchase_stock_usability
delivery_partner_id = fields.Many2one(
'res.partner', compute='_compute_delivery_partner_id')
"res.partner", compute="_compute_delivery_partner_id"
)
@api.depends('dest_address_id')
@api.depends("dest_address_id")
def _compute_delivery_partner_id(self):
for order in self:
order.delivery_partner_id = order.dest_address_id
# Re-write native name_get() to use amount_untaxed instead of amount_total
@api.depends('name', 'partner_ref')
@api.depends("name", "partner_ref")
def name_get(self):
result = []
for po in self:
name = po.name
if po.partner_ref:
name += ' (' + po.partner_ref + ')'
if self.env.context.get('show_total_amount') and po.amount_untaxed:
name += ': ' + formatLang(
self.env, po.amount_untaxed, currency_obj=po.currency_id)
name += " (" + po.partner_ref + ")"
if self.env.context.get("show_total_amount") and po.amount_untaxed:
name += ": " + formatLang(
self.env, po.amount_untaxed, currency_obj=po.currency_id
)
result.append((po.id, name))
return result
@@ -45,18 +47,18 @@ class PurchaseOrder(models.Model):
has_sections = False
subtotal = 0.0
for line in self.order_line:
if line.display_type == 'line_section':
if line.display_type == "line_section":
# insert line
if has_sections:
res.append({'subtotal': subtotal})
res.append({"subtotal": subtotal})
subtotal = 0.0 # reset counter
has_sections = True
else:
if not line.display_type:
subtotal += line.price_subtotal
res.append({'line': line})
res.append({"line": line})
if has_sections: # insert last subtotal line
res.append({'subtotal': subtotal})
res.append({"subtotal": subtotal})
# res:
# [
# {'line': sale_order_line(1) with display_type=='line_section'},
@@ -69,7 +71,9 @@ class PurchaseOrder(models.Model):
class PurchaseOrderLine(models.Model):
_inherit = 'purchase.order.line'
_inherit = "purchase.order.line"
# for optional display in tree view
product_barcode = fields.Char(related='product_id.barcode', string="Product Barcode")
product_barcode = fields.Char(
related="product_id.barcode", string="Product Barcode"
)

View File

@@ -6,6 +6,6 @@ from odoo import fields, models
class ResPartner(models.Model):
_inherit = 'res.partner'
_inherit = "res.partner"
purchase_warn = fields.Selection(tracking=True)