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"
|
||||
|
||||
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)]},
|
||||
)
|
||||
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)]")
|
||||
|
||||
@@ -93,7 +98,7 @@ class Rma(models.Model):
|
||||
|
||||
def _get_refund_line_product(self):
|
||||
"""To be overriden in a third module with the proper origin values
|
||||
in case a kit is linked with the rma """
|
||||
in case a kit is linked with the rma"""
|
||||
if not self.sale_line_id:
|
||||
return super()._get_refund_line_product()
|
||||
return self.sale_line_id.product_id
|
||||
|
||||
@@ -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)]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* Copyright 2021 Tecnativa - David Vidal
|
||||
License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). */
|
||||
|
||||
odoo.define("rma_sale.animation", function(require) {
|
||||
odoo.define("rma_sale.animation", function (require) {
|
||||
"use strict";
|
||||
|
||||
var sAnimation = require("website.content.snippets.animation");
|
||||
@@ -10,16 +10,16 @@ odoo.define("rma_sale.animation", function(require) {
|
||||
// selector so the user doesn't miss the chance to add his comments
|
||||
sAnimation.registry.rma_operation_portal = sAnimation.Class.extend({
|
||||
selector: ".rma-operation",
|
||||
start: function() {
|
||||
start: function () {
|
||||
this.id = this.el.name.replace("-operation_id", "");
|
||||
this.$comment = $("#comment-" + this.id);
|
||||
this.$comment_input = $("[name='" + this.id + "-description']");
|
||||
var _this = this;
|
||||
this.$el.on("change", function() {
|
||||
this.$el.on("change", function () {
|
||||
_this._onChangeOperationId();
|
||||
});
|
||||
},
|
||||
_show_comment: function() {
|
||||
_show_comment: function () {
|
||||
if (this.$comment) {
|
||||
this.$comment.removeClass("show");
|
||||
this.$comment.addClass("show");
|
||||
@@ -28,12 +28,12 @@ odoo.define("rma_sale.animation", function(require) {
|
||||
}
|
||||
}
|
||||
},
|
||||
_hide_comment: function() {
|
||||
_hide_comment: function () {
|
||||
if (this.$comment) {
|
||||
this.$comment.removeClass("show");
|
||||
}
|
||||
},
|
||||
_onChangeOperationId: function() {
|
||||
_onChangeOperationId: function () {
|
||||
// Toggle comment on or off if an operation is requested
|
||||
if (this.$el && this.$el.val()) {
|
||||
this._show_comment();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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")
|
||||
|
||||
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