forked from ForgeFlow/stock-rma
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge commit 'refs/pull/172/head' of https://github.com/ForgeFlow/sto…
…ck-rma into fko/14.0.1.0.0
- Loading branch information
Showing
9 changed files
with
145 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
==================== | ||
RMA Website Delivery | ||
==================== | ||
|
||
.. image:: https://img.shields.io/badge/licence-LGPL--3-blue.svg | ||
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html | ||
:alt: License: LGPL-3 | ||
|
||
This module allows you to provide the shipping label to your customer to return | ||
products. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Usage | ||
===== | ||
|
||
* Go to RMA | ||
* Create or select a record | ||
* Create the incoming shipment for the return | ||
* Open the receipt and click on "Get Return Label" | ||
* The label will be attached to the RMA order and to the email sent to the customer. | ||
|
||
Credits | ||
======= | ||
|
||
Authors | ||
~~~~~~~ | ||
|
||
* Open Source Integrators <contact@opensourceintegrators.com> | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* Ammar Officewala <aofficewala@opensourceintegrators.com> | ||
* Melody Fetterly <mfetterly@opensourceintegrators.com> | ||
* Raphael Lee <rlee@opensourceintegrators.com> | ||
* Maxime Chambreuil <mchambreuil@opensourceintegrators.com> | ||
|
||
Maintainers | ||
~~~~~~~~~~~ | ||
|
||
This module is maintained by ForgeFlow. | ||
|
||
This module is part of the `ForgeFlow/stock-rma <https://github.com/ForgeFlow/stock-rma>`_ project on GitHub. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Copyright (C) 2021 Open Source Integrators | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Copyright (C) 2021 Open Source Integrators | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). | ||
{ | ||
"name": "RMA Website Delivery", | ||
"version": "14.0.1.0.0", | ||
"license": "LGPL-3", | ||
"summary": "Provide the return label to your customers", | ||
"author": "Open Source Integrators", | ||
"maintainer": "ForgeFlow", | ||
"website": "https://github.com/ForgeFlow/stock-rma", | ||
"depends": ["rma_website", "delivery"], | ||
"data": [ | ||
"data/mail_template.xml", | ||
"views/stock_picking_view.xml", | ||
], | ||
"maintainers": ["ursais"], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<odoo> | ||
|
||
<record id="rma_return_label_mail" model="mail.template"> | ||
<field name="name">Return Label</field> | ||
<field name="email_from">${(user.partner_id.email or '')|safe}</field> | ||
<field name="subject">Return Label</field> | ||
<field name="email_to">${(object.partner_id.email or '')|safe}</field> | ||
<field name="model_id" ref="rma.model_rma_order" /> | ||
<field | ||
name="body_html" | ||
><![CDATA[ | ||
<p>Hello ${object.partner_id.name},</p> | ||
<p>Please find attached the shipping label to return your products.</p> | ||
<p>Thank you,</p> | ||
]]> | ||
</field> | ||
</record> | ||
|
||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Copyright (C) 2021 Open Source Integrators | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). | ||
from . import stock_picking |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Copyright (C) 2021 Open Source Integrators | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). | ||
from odoo import _, models | ||
from odoo.exceptions import UserError | ||
|
||
|
||
class StockPicking(models.Model): | ||
_inherit = "stock.picking" | ||
|
||
def get_return_label(self): | ||
for rec in self: | ||
if not rec.carrier_id: | ||
raise UserError(_("You need to assign the carrier.")) | ||
else: | ||
rma_order_line_id = self.env["rma.order.line"].search( | ||
[("name", "=", rec.origin)] | ||
) | ||
if rma_order_line_id and rma_order_line_id.rma_id: | ||
data, labels = rec.carrier_id.get_return_label(self) | ||
rec.carrier_tracking_ref = data["tracking_number"] | ||
mail_template = self.env.ref( | ||
"rma_website_delivery.rma_return_label_mail" | ||
) | ||
attach_id = self.env["ir.attachment"].search( | ||
[("name", "=", labels[0][0])], limit=1 | ||
) | ||
mail_template.write({"attachment_ids": [(6, 0, attach_id.ids)]}) | ||
mail_template.send_mail( | ||
rma_order_line_id.rma_id.id, force_send=True | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<odoo> | ||
|
||
<record id="view_picking_form_inherit_rma_delivery" model="ir.ui.view"> | ||
<field name="name">stock.picking.form</field> | ||
<field name="model">stock.picking</field> | ||
<field name="inherit_id" ref="stock.view_picking_form" /> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//header/button[@name='action_cancel']" position="after"> | ||
<button | ||
name="get_return_label" | ||
string="Get Return Label" | ||
type="object" | ||
attrs="{'invisible': [('picking_type_id', '!=', %(rma.picking_type_rma_cust_in)d), ('carrier_id','=',False)]}" | ||
/> | ||
</xpath> | ||
</field> | ||
</record> | ||
|
||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../rma_website_delivery |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
setup_requires=['setuptools-odoo'], | ||
odoo_addon=True, | ||
) |