Skip to content

Commit

Permalink
[17.0][MIG] deltatech_sale_pallet_website
Browse files Browse the repository at this point in the history
  • Loading branch information
VoicuStefan2001 committed Jul 9, 2024
1 parent ffd2861 commit 7cc8d6b
Show file tree
Hide file tree
Showing 16 changed files with 624 additions and 15 deletions.
3 changes: 2 additions & 1 deletion deltatech_business_process_documentation/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ Business process documentation
|badge1| |badge2| |badge3|

Features:
---------

-

**Table of contents**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,35 +370,40 @@ <h1 class="title">Business process documentation</h1>
!! source digest: sha256:e746bfee1fbe1c212af1a2c575931bae51e31786f9af2f5869323a09a75d8d05
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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/17.0/deltatech_business_process_documentation"><img alt="dhongu/deltatech" src="https://img.shields.io/badge/github-dhongu%2Fdeltatech-lightgray.png?logo=github" /></a></p>
<div class="section" id="features">
<h1>Features:</h1>
<p>Features:</p>
<ul class="simple">
<li></li>
</ul>
<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></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>
</ul>
</li>
</ul>
</div>
<div class="section" id="bug-tracker">
<h2><a class="toc-backref" href="#toc-entry-1">Bug Tracker</a></h2>
<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">
<h2><a class="toc-backref" href="#toc-entry-2">Credits</a></h2>
</div>
</div>
<h1><a class="toc-backref" href="#toc-entry-2">Credits</a></h1>
<div class="section" id="authors">
<h1>Authors</h1>
<h2><a class="toc-backref" href="#toc-entry-3">Authors</a></h2>
<ul class="simple">
<li>Terrabit</li>
<li>Nexterp</li>
<li>Fekete Mihai</li>
</ul>
</div>
<div class="section" id="contributors">
<h1>Contributors</h1>
<h2><a class="toc-backref" href="#toc-entry-4">Contributors</a></h2>
<ul class="simple">
<li><a class="reference external" href="https://www.nexterp.ro">NextERP Romania</a>:<ul>
<li>Fekete Mihai &lt;<a class="reference external" href="mailto:feketemihai&#64;nexterp.ro">feketemihai&#64;nexterp.ro</a>&gt;</li>
Expand All @@ -409,12 +414,13 @@ <h1>Contributors</h1>
technical issues.</p>
</div>
<div class="section" id="maintainers">
<h1>Maintainers</h1>
<h2><a class="toc-backref" href="#toc-entry-5">Maintainers</a></h2>
<p>Current maintainer:</p>
<p><a class="reference external image-reference" href="https://github.com/dhongu"><img alt="dhongu" src="https://github.com/dhongu.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/dhongu/deltatech/tree/17.0/deltatech_business_process_documentation">dhongu/deltatech</a> project on GitHub.</p>
<p>You are welcome to contribute.</p>
</div>
</div>
</div>
</body>
</html>
15 changes: 11 additions & 4 deletions deltatech_sale_pallet/models/product_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,17 @@ class ProductTemplate(models.Model):

@api.onchange("pallet_product_id", "pallet_qty_min")
def _compute_pallet_price(self):
main_pricelist = self.env.ref("product.list0", False)
for template in self:
price = main_pricelist._get_product_price(template, template.pallet_qty_min)
price = price * template.pallet_qty_min
price = 0

Check warning on line 19 in deltatech_sale_pallet/models/product_template.py

View check run for this annotation

Codecov / codecov/patch

deltatech_sale_pallet/models/product_template.py#L19

Added line #L19 was not covered by tests
if template.pallet_product_id:
price = price + template.pallet_product_id.list_price
price = template.pallet_product_id.list_price

Check warning on line 21 in deltatech_sale_pallet/models/product_template.py

View check run for this annotation

Codecov / codecov/patch

deltatech_sale_pallet/models/product_template.py#L21

Added line #L21 was not covered by tests
if template.pallet_qty_min:
price = price + template.pallet_qty_min * template.list_price

Check warning on line 23 in deltatech_sale_pallet/models/product_template.py

View check run for this annotation

Codecov / codecov/patch

deltatech_sale_pallet/models/product_template.py#L23

Added line #L23 was not covered by tests
template.pallet_price = price
# main_pricelist = self.env.ref("product.list", False)
# for template in self:
# price = main_pricelist._get_product_price(template, template.pallet_qty_min)
# price = price * template.pallet_qty_min
# if template.pallet_product_id:
# price = price + template.pallet_product_id.list_price
# template.pallet_price = price
65 changes: 65 additions & 0 deletions deltatech_sale_pallet_website/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
===================
Sale Pallet Website
===================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:06399ff53e0880eb46d8c675ddc444a2b288082022b2407c3cb43a1f059d1f10
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
:target: https://odoo-community.org/page/development-status
:alt: Production/Stable
.. |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/17.0/deltatech_sale_pallet_website
:alt: dhongu/deltatech

|badge1| |badge2| |badge3|

Features:

- addon for deltatech_sale_pallet that makes it possible for customers
to see the price of the order with the pallets price included

**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
* Dorin Hongu

Maintainers
-----------

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

Current maintainer:

|maintainer-dhongu|

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

You are welcome to contribute.
6 changes: 6 additions & 0 deletions deltatech_sale_pallet_website/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# © 2008-2021 Deltatech
# Dorin Hongu <dhongu(@)gmail(.)com
# See README.rst file on addons root folder for license details

from . import controllers
from . import models
17 changes: 17 additions & 0 deletions deltatech_sale_pallet_website/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# © 2008-2019 Deltatech
# Dorin Hongu <dhongu(@)gmail(.)com
# See README.rst file on addons root folder for license details
{
"name": "Sale Pallet Website",
"summary": "Sale pallet",
"version": "17.0.1.0.2",
"author": "Terrabit, Dorin Hongu",
"website": "https://www.terrabit.ro",
"category": "Sales",
"depends": ["deltatech_sale_pallet", "website_sale"],
"license": "OPL-1",
"data": ["views/templates.xml"],
"images": ["static/description/main_screenshot.png"],
"development_status": "Production/Stable",
"maintainers": ["dhongu"],
}
3 changes: 3 additions & 0 deletions deltatech_sale_pallet_website/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# © 2008-2021 Deltatech
# Dorin Hongu <dhongu(@)gmail(.)com
# See README.rst file on addons root folder for license details
26 changes: 26 additions & 0 deletions deltatech_sale_pallet_website/i18n/ro.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * deltatech_sale_pallet_website
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-04-23 08:07+0000\n"
"PO-Revision-Date: 2021-04-23 08:07+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_pallet_website
#: model_terms:ir.ui.view,arch_db:deltatech_sale_pallet_website.show_pallet_price
msgid "When buying"
msgstr "La achiziția de"

#. module: deltatech_sale_pallet_website
#: model_terms:ir.ui.view,arch_db:deltatech_sale_pallet_website.show_pallet_price
msgid "price is"
msgstr "prețul este de"
4 changes: 4 additions & 0 deletions deltatech_sale_pallet_website/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# © 2017-2021 Deltatech
# See README.rst file on addons root folder for license details

from . import sale
29 changes: 29 additions & 0 deletions deltatech_sale_pallet_website/models/sale.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# © 2008-2021 Deltatech
# See README.rst file on addons root folder for license details


from odoo import models


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

def _cart_update(self, product_id=None, line_id=None, add_qty=0, set_qty=0, **kwargs):
res = super()._cart_update(product_id=product_id, line_id=line_id, add_qty=add_qty, set_qty=set_qty, **kwargs)
pallets = self.recompute_pallet_lines(delete_if_under=True)

Check warning on line 13 in deltatech_sale_pallet_website/models/sale.py

View check run for this annotation

Codecov / codecov/patch

deltatech_sale_pallet_website/models/sale.py#L12-L13

Added lines #L12 - L13 were not covered by tests

if pallets:
for line in self.order_line:
pallet = pallets.pop(line.product_id.id, False)

Check warning on line 17 in deltatech_sale_pallet_website/models/sale.py

View check run for this annotation

Codecov / codecov/patch

deltatech_sale_pallet_website/models/sale.py#L17

Added line #L17 was not covered by tests
if pallet:
product_uom_qty = pallet["product_uom_qty"]

Check warning on line 19 in deltatech_sale_pallet_website/models/sale.py

View check run for this annotation

Codecov / codecov/patch

deltatech_sale_pallet_website/models/sale.py#L19

Added line #L19 was not covered by tests
if product_uom_qty:
line.write({"product_uom_qty": product_uom_qty})

Check warning on line 21 in deltatech_sale_pallet_website/models/sale.py

View check run for this annotation

Codecov / codecov/patch

deltatech_sale_pallet_website/models/sale.py#L21

Added line #L21 was not covered by tests
else:
line.unlink()

Check warning on line 23 in deltatech_sale_pallet_website/models/sale.py

View check run for this annotation

Codecov / codecov/patch

deltatech_sale_pallet_website/models/sale.py#L23

Added line #L23 was not covered by tests

for product_id in pallets:
if pallets[product_id]["product_uom_qty"]:
self.env["sale.order.line"].create(pallets[product_id])

Check warning on line 27 in deltatech_sale_pallet_website/models/sale.py

View check run for this annotation

Codecov / codecov/patch

deltatech_sale_pallet_website/models/sale.py#L27

Added line #L27 was not covered by tests

return res

Check warning on line 29 in deltatech_sale_pallet_website/models/sale.py

View check run for this annotation

Codecov / codecov/patch

deltatech_sale_pallet_website/models/sale.py#L29

Added line #L29 was not covered by tests
3 changes: 3 additions & 0 deletions deltatech_sale_pallet_website/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
4 changes: 4 additions & 0 deletions deltatech_sale_pallet_website/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Features:

- addon for deltatech_sale_pallet that makes it possible for customers to see the price of the order with the pallets
price included
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 7cc8d6b

Please sign in to comment.