mirror of
https://github.com/OCA/rma.git
synced 2025-02-16 17:11:47 +02:00
[IMP] rma_sale: black, isort, prettier
This commit is contained in:
@@ -7,5 +7,6 @@ class ResConfigSettings(models.TransientModel):
|
|||||||
_inherit = "res.config.settings"
|
_inherit = "res.config.settings"
|
||||||
|
|
||||||
show_full_page_sale_rma = fields.Boolean(
|
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,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -18,16 +18,21 @@ class Rma(models.Model):
|
|||||||
states={"draft": [("readonly", False)]},
|
states={"draft": [("readonly", False)]},
|
||||||
)
|
)
|
||||||
allowed_picking_ids = fields.Many2many(
|
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)]")
|
picking_id = fields.Many2one(domain="[('id', 'in', allowed_picking_ids)]")
|
||||||
allowed_move_ids = fields.Many2many(
|
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)]")
|
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(
|
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)]")
|
product_id = fields.Many2one(domain="[('id', 'in', allowed_product_ids)]")
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,10 @@ class SaleOrder(models.Model):
|
|||||||
|
|
||||||
# RMAs that were created from a sale order
|
# RMAs that were created from a sale order
|
||||||
rma_ids = fields.One2many(
|
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")
|
rma_count = fields.Integer(string="RMA count", compute="_compute_rma_count")
|
||||||
|
|
||||||
@@ -61,7 +64,9 @@ class SaleOrder(models.Model):
|
|||||||
rma = self.rma_ids
|
rma = self.rma_ids
|
||||||
if len(rma) == 1:
|
if len(rma) == 1:
|
||||||
action.update(
|
action.update(
|
||||||
res_id=rma.id, view_mode="form", views=[],
|
res_id=rma.id,
|
||||||
|
view_mode="form",
|
||||||
|
views=[],
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
action["domain"] = [("id", "in", rma.ids)]
|
action["domain"] = [("id", "in", rma.ids)]
|
||||||
|
|||||||
@@ -97,7 +97,8 @@ class TestRmaSale(SavepointCase):
|
|||||||
)
|
)
|
||||||
delivery_form = Form(
|
delivery_form = Form(
|
||||||
self.env["rma.delivery.wizard"].with_context(
|
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
|
delivery_form.product_uom_qty = rma.product_uom_qty
|
||||||
|
|||||||
@@ -75,7 +75,10 @@ class SaleOrderRmaWizard(models.TransientModel):
|
|||||||
action["domain"] = [("id", "in", rma.ids)]
|
action["domain"] = [("id", "in", rma.ids)]
|
||||||
elif rma:
|
elif rma:
|
||||||
action.update(
|
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
|
return action
|
||||||
|
|
||||||
@@ -101,10 +104,13 @@ class SaleOrderLineRmaWizard(models.TransientModel):
|
|||||||
domain="[('id', 'in', allowed_product_ids)]",
|
domain="[('id', 'in', allowed_product_ids)]",
|
||||||
)
|
)
|
||||||
uom_category_id = fields.Many2one(
|
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(
|
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(
|
uom_id = fields.Many2one(
|
||||||
comodel_name="uom.uom",
|
comodel_name="uom.uom",
|
||||||
@@ -122,9 +128,12 @@ class SaleOrderLineRmaWizard(models.TransientModel):
|
|||||||
)
|
)
|
||||||
move_id = fields.Many2one(comodel_name="stock.move", compute="_compute_move_id")
|
move_id = fields.Many2one(comodel_name="stock.move", compute="_compute_move_id")
|
||||||
operation_id = fields.Many2one(
|
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()
|
description = fields.Text()
|
||||||
|
|
||||||
@api.onchange("product_id")
|
@api.onchange("product_id")
|
||||||
|
|||||||
1
setup/rma_sale/odoo/addons/rma_sale
Symbolic link
1
setup/rma_sale/odoo/addons/rma_sale
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../../../../rma_sale
|
||||||
6
setup/rma_sale/setup.py
Normal file
6
setup/rma_sale/setup.py
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
import setuptools
|
||||||
|
|
||||||
|
setuptools.setup(
|
||||||
|
setup_requires=['setuptools-odoo'],
|
||||||
|
odoo_addon=True,
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user