Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/16.0' into 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dhongu committed Oct 26, 2024
2 parents 62b8681 + ca89f49 commit a0aae81
Show file tree
Hide file tree
Showing 14 changed files with 319 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ addon | version | maintainers | summary | price
[deltatech_sale_picking_status](deltatech_sale_picking_status/) | 16.0.1.0.1 | [![danila12](https://github.com/danila12.png?size=30px)](https://github.com/danila12) | Get sale order status from pickings | Free
[deltatech_sale_purchase](deltatech_sale_purchase/) | 16.0.1.0.1 | [![dhongu](https://github.com/dhongu.png?size=30px)](https://github.com/dhongu) | Sale Purchase | Free
[deltatech_sale_qty_available](deltatech_sale_qty_available/) | 16.0.1.0.0 | [![dhongu](https://github.com/dhongu.png?size=30px)](https://github.com/dhongu) | Quantity Available | Free
[deltatech_sale_return_cause](deltatech_sale_return_cause/) | 16.0.0.0.0 | [![VoicuStefan2001](https://github.com/VoicuStefan2001.png?size=30px)](https://github.com/VoicuStefan2001) | Return Cause | Free
[deltatech_sale_stage](deltatech_sale_stage/) | 16.0.1.1.3 | [![dhongu](https://github.com/dhongu.png?size=30px)](https://github.com/dhongu) | Sale Order Stage | Free
[deltatech_sale_team](deltatech_sale_team/) | 16.0.1.0.2 | | Sale Team Access | Free
[deltatech_sale_transfer](deltatech_sale_transfer/) | 16.0.1.0.3 | [![danila12](https://github.com/danila12.png?size=30px)](https://github.com/danila12) | Sale Prepare Transfer | Free
Expand Down
63 changes: 63 additions & 0 deletions deltatech_sale_return_cause/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
=================
Sale Return Cause
=================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:560b785034496a42cc3f92d1a468e751255cc1e14a003fc9e3765756afd0c7f0
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-OPL--1-blue.png
:target: https://www.odoo.com/documentation/master/legal/licenses.html
:alt: License: OPL-1
.. |badge3| image:: https://img.shields.io/badge/github-dhongu%2Fdeltatech-lightgray.png?logo=github
:target: https://github.com/dhongu/deltatech/tree/16.0/deltatech_sale_return_cause
:alt: dhongu/deltatech

|badge1| |badge2| |badge3|

Features:
- Adds the cause and the value of the return, every day it checks the return amount and updates it for the orders in the last year.

**Table of contents**

.. contents::
:local:

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

Bugs are tracked on `Terrabit Issues <https://www.terrabit.ro/helpdesk>`_.
In case of trouble, please check there if your issue has already been reported.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* Terrabit
* Voicu Stefan

Maintainers
~~~~~~~~~~~

.. |maintainer-VoicuStefan2001| image:: https://github.com/VoicuStefan2001.png?size=40px
:target: https://github.com/VoicuStefan2001
:alt: VoicuStefan2001

Current maintainer:

|maintainer-VoicuStefan2001|

This module is part of the `dhongu/deltatech <https://github.com/dhongu/deltatech/tree/16.0/deltatech_sale_return_cause>`_ project on GitHub.

You are welcome to contribute.
1 change: 1 addition & 0 deletions deltatech_sale_return_cause/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
18 changes: 18 additions & 0 deletions deltatech_sale_return_cause/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# © 2008-2021 Deltatech
# Dorin Hongu <dhongu(@)gmail(.)com
# See README.rst file on addons root folder for license details
{
"name": "Sale Return Cause",
"summary": "Return Cause",
"version": "16.0.0.0.0",
"author": "Terrabit, Voicu Stefan",
"website": "https://www.terrabit.ro",
"category": "Sales",
"depends": ["sale"],
"license": "OPL-1",
"data": ["views/sale_order_view.xml", "data/ir_cron_data.xml"],
"images": ["images/main_screenshot.png"],
"installable": True,
"development_status": "Beta",
"maintainers": ["VoicuStefan2001"],
}
15 changes: 15 additions & 0 deletions deltatech_sale_return_cause/data/ir_cron_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<odoo>
<data noupdate="1">
<record id="ir_cron_check_and_update_return_amount" model="ir.cron">
<field name="name">Check and Update Return Amount</field>
<field name="model_id" ref="model_sale_order" />
<field name="state">code</field>
<field name="code">model._cron_check_and_update_return_amount()</field>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
<field name="doall">False</field>
<field name="active">True</field>
</record>
</data>
</odoo>
82 changes: 82 additions & 0 deletions deltatech_sale_return_cause/i18n/ro.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * deltatech_sale_return_cause
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-10-25 12:16+0000\n"
"PO-Revision-Date: 2024-10-25 12:16+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: deltatech_sale_return_cause
#: model:ir.model.fields.selection,name:deltatech_sale_return_cause.selection__sale_order__return_cause__200_warranty
msgid "200% warranty"
msgstr "Garantia 200%"

#. module: deltatech_sale_return_cause
#: model:ir.actions.server,name:deltatech_sale_return_cause.ir_cron_check_and_update_return_amount_ir_actions_server
#: model:ir.cron,cron_name:deltatech_sale_return_cause.ir_cron_check_and_update_return_amount
msgid "Check and Update Return Amount"
msgstr "Verifica si actualizeaza suma returnata"

#. module: deltatech_sale_return_cause
#: model:ir.model.fields.selection,name:deltatech_sale_return_cause.selection__sale_order__return_cause__does_not_expect
msgid "Does not expect the order"
msgstr "Nu asteapta comanda"

#. module: deltatech_sale_return_cause
#: model:ir.model.fields.selection,name:deltatech_sale_return_cause.selection__sale_order__return_cause__does_not_fit
msgid "Does not fit"
msgstr "Nu se potrivesc desi sunt dedicate"

#. module: deltatech_sale_return_cause
#: model:ir.model.fields.selection,name:deltatech_sale_return_cause.selection__sale_order__return_cause__duplicate_order
msgid "Duplicate order"
msgstr "Comanda dublata"

#. module: deltatech_sale_return_cause
#: model:ir.model.fields.selection,name:deltatech_sale_return_cause.selection__sale_order__return_cause__sale_team_mistake
msgid "Incorrectly advised by Sales"
msgstr "Consiliat gresit de CC"

#. module: deltatech_sale_return_cause
#: model:ir.model.fields.selection,name:deltatech_sale_return_cause.selection__sale_order__return_cause__not_satisfied
msgid "Not satisfied with quality"
msgstr "Nu este multumit de calitate"

#. module: deltatech_sale_return_cause
#: model:ir.model.fields.selection,name:deltatech_sale_return_cause.selection__sale_order__return_cause__ordered_incorrectly
msgid "Ordered incorrectly by client"
msgstr "Comandat gresit de client"

#. module: deltatech_sale_return_cause
#: model:ir.model.fields.selection,name:deltatech_sale_return_cause.selection__sale_order__return_cause__not_picked
msgid "Package not picked up by client"
msgstr "Colet neridicat de client"

#. module: deltatech_sale_return_cause
#: model:ir.model.fields,field_description:deltatech_sale_return_cause.field_sale_order__return_amount
msgid "Return Amount"
msgstr "Valoare retur"

#. module: deltatech_sale_return_cause
#: model:ir.model.fields,field_description:deltatech_sale_return_cause.field_sale_order__return_cause
msgid "Return Cause"
msgstr "Motiv retur"

#. module: deltatech_sale_return_cause
#: model:ir.model,name:deltatech_sale_return_cause.model_sale_order
msgid "Sales Order"
msgstr "Comandă vânzare"

#. module: deltatech_sale_return_cause
#: model:ir.model.fields.selection,name:deltatech_sale_return_cause.selection__sale_order__return_cause__wrong_shipped
msgid "Wrongly shipped warehouse"
msgstr "Expediat gresit depozit"
1 change: 1 addition & 0 deletions deltatech_sale_return_cause/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import sale_order
40 changes: 40 additions & 0 deletions deltatech_sale_return_cause/models/sale_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
from datetime import datetime, timedelta

from odoo import api, fields, models


class SaleOrder(models.Model):
_inherit = "sale.order"

return_cause = fields.Selection(
selection=[
("not_satisfied", "Not satisfied with quality"),
("wrong_shipped", "Wrongly shipped warehouse"),
("ordered_incorrectly", "Ordered incorrectly by client"),
("does_not_fit", "Does not fit"),
("sale_team_mistake", "Incorrectly advised by Sales"),
("duplicate_order", "Duplicate order"),
("does_not_expect", "Does not expect the order"),
("200_warranty", "200% warranty"),
("not_picked", "Package not picked up by client"),
],
string="Return Cause",
)
return_amount = fields.Float(string="Return Amount", digits="Product Price", default=0.0, readonly=True)

@api.model
def _cron_check_and_update_return_amount(self):
one_year_ago = datetime.today() - timedelta(days=365)
sale_orders = self.search([("date_order", ">=", one_year_ago), ("return_cause", "!=", False)])
for order in sale_orders:
order.check_and_update_return_amount()

def check_and_update_return_amount(self):
for order in self:
if self.return_cause and self.invoice_count >= 2:
# Get all credit notes related to these invoices
credit_notes = self.invoice_ids.filtered(lambda x: x.move_type == "out_refund" and x.state == "posted")
total_credit_amount = sum(credit_notes.mapped(lambda x: x.amount_total_signed))

# Update the return_amount field
order.return_amount = total_credit_amount
2 changes: 2 additions & 0 deletions deltatech_sale_return_cause/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Features:
- Adds the cause and the value of the return, every day it checks the return amount and updates it for the orders in the last year.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
63 changes: 63 additions & 0 deletions deltatech_sale_return_cause/static/description/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
<title>Sale Return Cause</title>
<link rel="stylesheet" href="https://fossies.org/linux/docutils/docutils/writers/html4css1/html4css1.css" type="text/css" />
</head>
<body>
<div class="document" id="sale-return-cause">
<h1 class="title">Sale Return Cause</h1>

<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:560b785034496a42cc3f92d1a468e751255cc1e14a003fc9e3765756afd0c7f0
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="https://www.odoo.com/documentation/master/legal/licenses.html"><img alt="License: OPL-1" src="https://img.shields.io/badge/licence-OPL--1-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/dhongu/deltatech/tree/16.0/deltatech_sale_return_cause"><img alt="dhongu/deltatech" src="https://img.shields.io/badge/github-dhongu%2Fdeltatech-lightgray.png?logo=github" /></a></p>
<dl class="docutils">
<dt>Features:</dt>
<dd><ul class="first last simple">
<li>Adds the cause and the value of the return, every day it checks the return amount and updates it for the orders in the last year.</li>
</ul>
</dd>
</dl>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-1">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="toc-entry-2">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="toc-entry-3">Authors</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-4">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#toc-entry-1">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://www.terrabit.ro/helpdesk">Terrabit Issues</a>.
In case of trouble, please check there if your issue has already been reported.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#toc-entry-2">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#toc-entry-3">Authors</a></h2>
<ul class="simple">
<li>Terrabit</li>
<li>Voicu Stefan</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-4">Maintainers</a></h2>
<p>Current maintainer:</p>
<p><a class="reference external image-reference" href="https://github.com/VoicuStefan2001"><img alt="VoicuStefan2001" src="https://github.com/VoicuStefan2001.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/dhongu/deltatech/tree/16.0/deltatech_sale_return_cause">dhongu/deltatech</a> project on GitHub.</p>
<p>You are welcome to contribute.</p>
</div>
</div>
</div>
</body>
</html>
26 changes: 26 additions & 0 deletions deltatech_sale_return_cause/views/sale_order_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<odoo>
<record id="view_order_form" model="ir.ui.view">
<field name="name">sale.order.form</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form" />
<field name="arch" type="xml">
<field name="tag_ids" position="after">
<group>
<field name="return_cause" />
<field name="return_amount" />
</group>
</field>
</field>
</record>

<!-- <record id="view_sale_order_pivot_inherit" model="ir.ui.view">-->
<!-- <field name="name">sale.order.pivot.inherit</field>-->
<!-- <field name="model">sale.order</field>-->
<!-- <field name="inherit_id" ref="sale.view_sale_order_pivot"/>-->
<!-- <field name="arch" type="xml">-->
<!-- <xpath expr="//pivot" position="inside">-->
<!-- <field name="return_amount" type="measure"/>-->
<!-- </xpath>-->
<!-- </field>-->
<!-- </record>-->
</odoo>
6 changes: 6 additions & 0 deletions setup/deltatech_sale_return_cause/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon={'odoo_version_override': '16.0'},
)

0 comments on commit a0aae81

Please sign in to comment.