Skip to content

Commit

Permalink
[MIG] sale_coupon_partner: Migration to version 16.0
Browse files Browse the repository at this point in the history
TT44351
  • Loading branch information
pilarvargas-tecnativa committed Sep 27, 2023
1 parent 51520b7 commit 4958874
Show file tree
Hide file tree
Showing 14 changed files with 84 additions and 90 deletions.
27 changes: 12 additions & 15 deletions sale_loyalty_partner/README.rst
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
===================
Sale Coupon Partner
===================
====================
Sale Loyalty Partner
====================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:c066b31d70310b0c1668307bb55275e85aa417a2b0fc876a07e39d732e29918c
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
Expand All @@ -17,18 +14,18 @@ Sale Coupon Partner
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsale--promotion-lightgray.png?logo=github
:target: https://github.com/OCA/sale-promotion/tree/15.0/sale_coupon_partner
:target: https://github.com/OCA/sale-promotion/tree/16.0/sale_loyalty_partner
:alt: OCA/sale-promotion
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/sale-promotion-15-0/sale-promotion-15-0-sale_coupon_partner
:target: https://translation.odoo-community.org/projects/sale-promotion-16-0/sale-promotion-16-0-sale_loyalty_partner
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/sale-promotion&target_branch=15.0
:target: https://runboat.odoo-community.org/webui/builds.html?repo=OCA/sale-promotion&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
|badge1| |badge2| |badge3| |badge4| |badge5|

This module adds the possibility to associate the coupon programs to a partner.
This module adds the possibility to associate the loyalty programs to a partner.

Furthermore, it adds the way to group by this partner on the Sales Analysis.

Expand All @@ -42,8 +39,8 @@ Bug Tracker

Bugs are tracked on `GitHub Issues <https://github.com/OCA/sale-promotion/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/sale-promotion/issues/new?body=module:%20sale_coupon_partner%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/sale-promotion/issues/new?body=module:%20sale_loyalty_partner%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Expand Down Expand Up @@ -77,6 +74,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/sale-promotion <https://github.com/OCA/sale-promotion/tree/15.0/sale_coupon_partner>`_ project on GitHub.
This module is part of the `OCA/sale-promotion <https://github.com/OCA/sale-promotion/tree/16.0/sale_loyalty_partner>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
8 changes: 4 additions & 4 deletions sale_loyalty_partner/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "Sale Coupon Partner",
"version": "15.0.1.0.0",
"name": "Sale Loyalty Partner",
"version": "16.0.1.0.0",
"author": "Tecnativa, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/sale-promotion",
"license": "AGPL-3",
"category": "Marketing",
"depends": ["sale_coupon_order_line_link"],
"data": ["views/sale_coupon_program_views.xml", "reports/sale_report_views.xml"],
"depends": ["sale_loyalty_order_line_link"],
"data": ["views/sale_loyalty_program_views.xml", "reports/sale_report_views.xml"],
"installable": True,
}
20 changes: 10 additions & 10 deletions sale_loyalty_partner/i18n/sale_coupon_partner.pot
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_coupon_partner
# * sale_loyalty_partner
#
msgid ""
msgstr ""
Expand All @@ -13,23 +13,23 @@ msgstr ""
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: sale_coupon_partner
#: model:ir.model.fields,field_description:sale_coupon_partner.field_sale_report__coupon_program_partner_id
#: model_terms:ir.ui.view,arch_db:sale_coupon_partner.view_order_product_search
#. module: sale_loyalty_partner
#: model:ir.model.fields,field_description:sale_loyalty_partner.field_sale_report__coupon_program_partner_id
#: model_terms:ir.ui.view,arch_db:sale_loyalty_partner.view_order_product_search
msgid "Coupon Program Partner"
msgstr ""

#. module: sale_coupon_partner
#: model:ir.model,name:sale_coupon_partner.model_coupon_program
#. module: sale_loyalty_partner
#: model:ir.model,name:sale_loyalty_partner.model_coupon_program
msgid "Coupon display on a website"
msgstr ""

#. module: sale_coupon_partner
#: model:ir.model.fields,field_description:sale_coupon_partner.field_coupon_program__partner_id
#. module: sale_loyalty_partner
#: model:ir.model.fields,field_description:sale_loyalty_partner.field_coupon_program__partner_id
msgid "Partner"
msgstr ""

#. module: sale_coupon_partner
#: model:ir.model,name:sale_coupon_partner.model_sale_report
#. module: sale_loyalty_partner
#: model:ir.model,name:sale_loyalty_partner.model_sale_report
msgid "Sales Analysis Report"
msgstr ""
2 changes: 1 addition & 1 deletion sale_loyalty_partner/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from . import sale_coupon_program
from . import sale_loyalty_program
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from odoo import fields, models


class SaleCouponProgram(models.Model):
_inherit = "coupon.program"
class LoyaltyProgram(models.Model):
_inherit = "loyalty.program"

partner_id = fields.Many2one(comodel_name="res.partner", string="Partner")
2 changes: 1 addition & 1 deletion sale_loyalty_partner/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
This module adds the possibility to associate the coupon programs to a partner.
This module adds the possibility to associate the loyalty programs to a partner.

Furthermore, it adds the way to group by this partner on the Sales Analysis.
33 changes: 16 additions & 17 deletions sale_loyalty_partner/reports/sale_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,22 @@
class SaleReport(models.Model):
_inherit = "sale.report"

coupon_program_partner_id = fields.Many2one(
loyalty_program_partner_id = fields.Many2one(
comodel_name="res.partner",
string="Coupon Program Partner",
string="Loyalty Program Partner",
)

def _query(self, with_clause="", fields=None, groupby="", from_clause=""):
if fields is None:
fields = {}
select_str = """ ,
scp.partner_id as coupon_program_partner_id
"""
from_clause += "left join coupon_program scp on (l.coupon_program_id = scp.id)"
fields.update({"coupon_program_partner_id": select_str})
groupby += ", scp.partner_id"
return super()._query(
with_clause=with_clause,
fields=fields,
groupby=groupby,
from_clause=from_clause,
)
def _select_additional_fields(self):
res = super()._select_additional_fields()
res["loyalty_program_partner_id"] = "scp.partner_id"
return res

def _from_sale(self):
res = super()._from_sale()
res += """ left join loyalty_program scp on (l.loyalty_program_id = scp.id)"""
return res

def _group_by_sale(self):
res = super()._group_by_sale()
res += """, scp.partner_id"""
return res
6 changes: 3 additions & 3 deletions sale_loyalty_partner/reports/sale_report_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
<field name="model">sale.report</field>
<field name="arch" type="xml">
<field name="user_id" position="before">
<field name="coupon_program_partner_id" />
<field name="loyalty_program_partner_id" />
</field>
<xpath expr="//filter[@name='promotion_group']" position="after">
<filter
string="Coupon Program Partner"
string="Loyalty Program Partner"
name="promotion_partner_group"
context="{'group_by': 'coupon_program_partner_id'}"
context="{'group_by': 'loyalty_program_partner_id'}"
/>
</xpath>
</field>
Expand Down
46 changes: 22 additions & 24 deletions sale_loyalty_partner/static/description/index.html
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<!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 Coupon Partner</title>
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
<title>Sale Loyalty Partner</title>
<style type="text/css">

/*
:Author: David Goodger ([email protected])
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/

Expand Down Expand Up @@ -360,48 +360,46 @@
</style>
</head>
<body>
<div class="document" id="sale-coupon-partner">
<h1 class="title">Sale Coupon Partner</h1>
<div class="document" id="sale-loyalty-partner">
<h1 class="title">Sale Loyalty Partner</h1>

<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:c066b31d70310b0c1668307bb55275e85aa417a2b0fc876a07e39d732e29918c
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/sale-promotion/tree/15.0/sale_coupon_partner"><img alt="OCA/sale-promotion" src="https://img.shields.io/badge/github-OCA%2Fsale--promotion-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/sale-promotion-15-0/sale-promotion-15-0-sale_coupon_partner"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/sale-promotion&amp;target_branch=15.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module adds the possibility to associate the coupon programs to a partner.</p>
<p><a class="reference external" 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" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/sale-promotion/tree/16.0/sale_loyalty_partner"><img alt="OCA/sale-promotion" src="https://img.shields.io/badge/github-OCA%2Fsale--promotion-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/sale-promotion-16-0/sale-promotion-16-0-sale_loyalty_partner"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runboat.odoo-community.org/webui/builds.html?repo=OCA/sale-promotion&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module adds the possibility to associate the loyalty programs to a partner.</p>
<p>Furthermore, it adds the way to group by this partner on the Sales Analysis.</p>
<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="#contributors" id="toc-entry-4">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-5">Maintainers</a></li>
<li><a class="reference internal" href="#bug-tracker" id="id1">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id2">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id3">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id4">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id5">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>
<h1><a class="toc-backref" href="#id1">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/sale-promotion/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/sale-promotion/issues/new?body=module:%20sale_coupon_partner%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/sale-promotion/issues/new?body=module:%20sale_loyalty_partner%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</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>
<h1><a class="toc-backref" href="#id2">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#toc-entry-3">Authors</a></h2>
<h2><a class="toc-backref" href="#id3">Authors</a></h2>
<ul class="simple">
<li>Tecnativa</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#toc-entry-4">Contributors</a></h2>
<h2><a class="toc-backref" href="#id4">Contributors</a></h2>
<ul class="simple">
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
<li>Pedro M. Baeza</li>
Expand All @@ -412,13 +410,13 @@ <h2><a class="toc-backref" href="#toc-entry-4">Contributors</a></h2>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-5">Maintainers</a></h2>
<h2><a class="toc-backref" href="#id5">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/sale-promotion/tree/15.0/sale_coupon_partner">OCA/sale-promotion</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/sale-promotion/tree/16.0/sale_loyalty_partner">OCA/sale-promotion</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
Expand Down
12 changes: 0 additions & 12 deletions sale_loyalty_partner/views/sale_coupon_program_views.xml

This file was deleted.

12 changes: 12 additions & 0 deletions sale_loyalty_partner/views/sale_loyalty_program_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record model="ir.ui.view" id="loyalty_program_view_form">
<field name="model">loyalty.program</field>
<field name="inherit_id" ref="loyalty.loyalty_program_view_form" />
<field name="arch" type="xml">
<field name="available_on" position="before">
<field name="partner_id" />
</field>
</field>
</record>
</odoo>
1 change: 0 additions & 1 deletion setup/sale_coupon_partner/odoo/addons/sale_coupon_partner

This file was deleted.

File renamed without changes.

0 comments on commit 4958874

Please sign in to comment.