Skip to content

Commit

Permalink
[ADD] ssi_rma_sale
Browse files Browse the repository at this point in the history
  • Loading branch information
andhit-r committed Nov 17, 2024
1 parent d375918 commit 0286a8c
Show file tree
Hide file tree
Showing 7 changed files with 165 additions and 0 deletions.
46 changes: 46 additions & 0 deletions ssi_rma_sale/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3

======================
RMA + Sale Integration
======================


Installation
============

To install this module, you need to:

1. Clone the branch 14.0 of the repository https://github.com/open-synergy/ssi-rma
2. Add the path to this repository in your configuration (addons-path)
3. Update the module list (Must be on developer mode)
4. Go to menu *Apps -> Apps -> Main Apps*
5. Search For *RMA + Sale Integration*
6. Install the module

Bug Tracker
===========

Bugs are tracked on `GitHub Issues
<https://github.com/open-synergy/ssi-rma/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smash it by providing detailed and welcomed feedback.


Credits
=======

Contributors
------------

* Andhitia Rama <[email protected]>

Maintainer
----------

.. image:: https://simetri-sinergi.id/logo.png
:alt: PT. Simetri Sinergi Indonesia
:target: https://simetri-sinergi.id.com

This module is maintained by the PT. Simetri Sinergi Indonesia.
7 changes: 7 additions & 0 deletions ssi_rma_sale/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Copyright 2023 OpenSynergy Indonesia
# Copyright 2023 PT. Simetri Sinergi Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import (
models,
)
18 changes: 18 additions & 0 deletions ssi_rma_sale/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2023 OpenSynergy Indonesia
# Copyright 2023 PT. Simetri Sinergi Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "RMA + Sale Integration",
"version": "14.0.1.0.0",
"website": "https://simetri-sinergi.id",
"author": "PT. Simetri Sinergi Indonesia, OpenSynergy Indonesia",
"license": "AGPL-3",
"installable": True,
"depends": ["ssi_rma_account", "ssi_sale"],
"data": [
"views/rma_customer_views.xml",
],
"demo": [],
"images": [],
}
8 changes: 8 additions & 0 deletions ssi_rma_sale/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright 2023 OpenSynergy Indonesia
# Copyright 2023 PT. Simetri Sinergi Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import (
rma_customer_line,
stock_rule,
)
48 changes: 48 additions & 0 deletions ssi_rma_sale/models/rma_customer_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Copyright 2023 OpenSynergy Indonesia
# Copyright 2023 PT. Simetri Sinergi Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import fields, models


class RMACustomerLine(models.Model):
_name = "rma_customer_line"
_inherit = [
"rma_line_mixin",
"rma_customer_line",
]

sale_line_id = fields.Many2one(
related="source_stock_move_id.sale_line_id",
store=False,
)

def _get_receipt_procurement_data(self):
_super = super(RMACustomerLine, self)
result = _super._get_receipt_procurement_data()
sale_line_id = self.sale_line_id and self.sale_line_id.id or False
to_refund = sale_line_id and True or False
result.update(
{
"sale_line_id": sale_line_id,
"to_refund": to_refund,
}
)
return result

def _get_delivery_procurement_data(self):
_super = super(RMACustomerLine, self)
result = _super._get_delivery_procurement_data()
sale_line_id = self.sale_line_id and self.sale_line_id.id or False
source_stock_move_id = (
self.source_stock_move_id and self.source_stock_move_id.id or False
)
to_refund = sale_line_id and True or False
result.update(
{
"sale_line_id": sale_line_id,
"origin_returned_move_id": source_stock_move_id,
"to_refund": to_refund,
}
)
return result
19 changes: 19 additions & 0 deletions ssi_rma_sale/models/stock_rule.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2023 OpenSynergy Indonesia
# Copyright 2023 PT. Simetri Sinergi Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import models


class StockRule(models.Model):
_name = "stock.rule"
_inherit = ["stock.rule"]

def _get_custom_move_fields(self):
_super = super(StockRule, self)
result = _super._get_custom_move_fields()
result += [
"to_refund",
"origin_returned_move_id",
]
return result
19 changes: 19 additions & 0 deletions ssi_rma_sale/views/rma_customer_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--Copyright 2023 OpenSynergy Indonesia-->
<!--Copyright 2023 PT. Simetri Sinergi Indonesia-->
<!--License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).-->
<odoo>

<record id="rma_customer_view_form" model="ir.ui.view">
<field name="name">RMA Customers - Form</field>
<field name="model">rma_customer</field>
<field name="inherit_id" ref="ssi_rma.rma_customer_view_form" />
<field name="arch" type="xml">
<data>
<xpath expr="//field[@name='source_stock_move_id']" position="after">
<field name="sale_line_id" />
</xpath>
</data>
</field>
</record>
</odoo>

0 comments on commit 0286a8c

Please sign in to comment.