[IMP] rma_sale: black, isort, prettier

This commit is contained in:
Chafique
2021-09-03 12:42:24 +02:00
parent 1f19985889
commit 8afb31c883
8 changed files with 48 additions and 20 deletions

View File

@@ -7,5 +7,6 @@ class ResConfigSettings(models.TransientModel):
_inherit = "res.config.settings"
show_full_page_sale_rma = fields.Boolean(
related="company_id.show_full_page_sale_rma", readonly=False,
related="company_id.show_full_page_sale_rma",
readonly=False,
)

View File

@@ -18,16 +18,21 @@ class Rma(models.Model):
states={"draft": [("readonly", False)]},
)
allowed_picking_ids = fields.Many2many(
comodel_name="stock.picking", compute="_compute_allowed_picking_ids",
comodel_name="stock.picking",
compute="_compute_allowed_picking_ids",
)
picking_id = fields.Many2one(domain="[('id', 'in', allowed_picking_ids)]")
allowed_move_ids = fields.Many2many(
comodel_name="sale.order.line", compute="_compute_allowed_move_ids",
comodel_name="sale.order.line",
compute="_compute_allowed_move_ids",
)
move_id = fields.Many2one(domain="[('id', 'in', allowed_move_ids)]")
sale_line_id = fields.Many2one(related="move_id.sale_line_id",)
sale_line_id = fields.Many2one(
related="move_id.sale_line_id",
)
allowed_product_ids = fields.Many2many(
comodel_name="product.product", compute="_compute_allowed_product_ids",
comodel_name="product.product",
compute="_compute_allowed_product_ids",
)
product_id = fields.Many2one(domain="[('id', 'in', allowed_product_ids)]")

View File

@@ -10,7 +10,10 @@ class SaleOrder(models.Model):
# RMAs that were created from a sale order
rma_ids = fields.One2many(
comodel_name="rma", inverse_name="order_id", string="RMAs", copy=False,
comodel_name="rma",
inverse_name="order_id",
string="RMAs",
copy=False,
)
rma_count = fields.Integer(string="RMA count", compute="_compute_rma_count")
@@ -61,7 +64,9 @@ class SaleOrder(models.Model):
rma = self.rma_ids
if len(rma) == 1:
action.update(
res_id=rma.id, view_mode="form", views=[],
res_id=rma.id,
view_mode="form",
views=[],
)
else:
action["domain"] = [("id", "in", rma.ids)]

View File

@@ -97,7 +97,8 @@ class TestRmaSale(SavepointCase):
)
delivery_form = Form(
self.env["rma.delivery.wizard"].with_context(
active_ids=rma.ids, rma_delivery_type="return",
active_ids=rma.ids,
rma_delivery_type="return",
)
)
delivery_form.product_uom_qty = rma.product_uom_qty

View File

@@ -75,7 +75,10 @@ class SaleOrderRmaWizard(models.TransientModel):
action["domain"] = [("id", "in", rma.ids)]
elif rma:
action.update(
res_id=rma.id, view_mode="form", view_id=False, views=False,
res_id=rma.id,
view_mode="form",
view_id=False,
views=False,
)
return action
@@ -101,10 +104,13 @@ class SaleOrderLineRmaWizard(models.TransientModel):
domain="[('id', 'in', allowed_product_ids)]",
)
uom_category_id = fields.Many2one(
comodel_name="uom.category", related="product_id.uom_id.category_id",
comodel_name="uom.category",
related="product_id.uom_id.category_id",
)
quantity = fields.Float(
string="Quantity", digits="Product Unit of Measure", required=True,
string="Quantity",
digits="Product Unit of Measure",
required=True,
)
uom_id = fields.Many2one(
comodel_name="uom.uom",
@@ -122,9 +128,12 @@ class SaleOrderLineRmaWizard(models.TransientModel):
)
move_id = fields.Many2one(comodel_name="stock.move", compute="_compute_move_id")
operation_id = fields.Many2one(
comodel_name="rma.operation", string="Requested operation",
comodel_name="rma.operation",
string="Requested operation",
)
sale_line_id = fields.Many2one(
comodel_name="sale.order.line",
)
sale_line_id = fields.Many2one(comodel_name="sale.order.line",)
description = fields.Text()
@api.onchange("product_id")

View File

@@ -0,0 +1 @@
../../../../rma_sale

6
setup/rma_sale/setup.py Normal file
View File

@@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)