-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1880 from VoicuStefan2001/16.0
[16.0][ADD] deltatech_pricelist_add_category
- Loading branch information
Showing
18 changed files
with
245 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
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,69 @@ | ||
======================= | ||
Price List add Category | ||
======================= | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:9da861cd00d0aeaf76615a6a6b62eed4d6114732b25bdd2029755ca774650b2e | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png | ||
:target: https://odoo-community.org/page/development-status | ||
:alt: Alpha | ||
.. |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_pricelist_add_category | ||
:alt: dhongu/deltatech | ||
|
||
|badge1| |badge2| |badge3| | ||
|
||
Features: | ||
- Gives you the possibility to add a category to a pricelist's products. | ||
- This is done by opening the action menu on the pricelist and selecting "Open Pricelist Wizard". | ||
|
||
.. IMPORTANT:: | ||
This is an alpha version, the data model and design can change at any time without warning. | ||
Only for development or testing purpose, do not use in production. | ||
`More details on development status <https://odoo-community.org/page/development-status>`_ | ||
|
||
**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 | ||
~~~~~~~ | ||
|
||
* cojocariudaniel1 | ||
* Terrabit | ||
|
||
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_pricelist_add_category>`_ project on GitHub. | ||
|
||
You are welcome to contribute. |
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 @@ | ||
from . import wizard |
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,18 @@ | ||
{ | ||
"name": "Price List add Category", | ||
"version": "16.0.0.0.1", | ||
"author": "cojocariudaniel1, Terrabit", | ||
"website": "https://www.terrabit.ro", | ||
"summary": "You can add a public category to the products in price list", | ||
"category": "Slales", | ||
"depends": ["sale_management", "product", "website_sale"], | ||
"data": [ | ||
"security/ir.model.access.csv", | ||
"data/server_action.xml", | ||
"wizard/pricelist_wizard_view.xml", | ||
], | ||
"license": "OPL-1", | ||
"images": ["static/description/main_screenshot.png"], | ||
"development_status": "Alpha", | ||
"maintainers": ["VoicuStefan2001"], | ||
} |
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,18 @@ | ||
<odoo> | ||
<record id="action_open_pricelist_wizard" model="ir.actions.server"> | ||
<field name="name">Open Pricelist Wizard</field> | ||
<field name="model_id" ref="product.model_product_pricelist" /> | ||
<field name="binding_model_id" ref="product.model_product_pricelist" /> | ||
<field name="state">code</field> | ||
<field name="code"> | ||
action = { | ||
'type': 'ir.actions.act_window', | ||
'name': 'Add Public Category', | ||
'res_model': 'pricelist.wizard', | ||
'view_mode': 'form', | ||
'target': 'new', | ||
'context': {'default_pricelist_id': record.id}, | ||
} | ||
</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 @@ | ||
Features: | ||
- Gives you the possibility to add a category to a pricelist's products. | ||
- This is done by opening the action menu on the pricelist and selecting "Open Pricelist Wizard". |
2 changes: 2 additions & 0 deletions
2
deltatech_pricelist_add_category/security/ir.model.access.csv
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,2 @@ | ||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | ||
deltatech_pricelist_add_category.access_pricelist_wizard,access_pricelist_wizard,deltatech_pricelist_add_category.model_pricelist_wizard,base.group_user,1,1,1,1 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
70 changes: 70 additions & 0 deletions
70
deltatech_pricelist_add_category/static/description/index.html
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,70 @@ | ||
<!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>Price List add Category</title> | ||
<link rel="stylesheet" href="https://fossies.org/linux/docutils/docutils/writers/html4css1/html4css1.css" type="text/css" /> | ||
</head> | ||
<body> | ||
<div class="document" id="price-list-add-category"> | ||
<h1 class="title">Price List add Category</h1> | ||
|
||
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:9da861cd00d0aeaf76615a6a6b62eed4d6114732b25bdd2029755ca774650b2e | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> | ||
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Alpha" src="https://img.shields.io/badge/maturity-Alpha-red.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_pricelist_add_category"><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>Gives you the possibility to add a category to a pricelist’s products.</li> | ||
<li>This is done by opening the action menu on the pricelist and selecting “Open Pricelist Wizard”.</li> | ||
</ul> | ||
</dd> | ||
</dl> | ||
<div class="admonition important"> | ||
<p class="first admonition-title">Important</p> | ||
<p class="last">This is an alpha version, the data model and design can change at any time without warning. | ||
Only for development or testing purpose, do not use in production. | ||
<a class="reference external" href="https://odoo-community.org/page/development-status">More details on development status</a></p> | ||
</div> | ||
<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>cojocariudaniel1</li> | ||
<li>Terrabit</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_pricelist_add_category">dhongu/deltatech</a> project on GitHub.</p> | ||
<p>You are welcome to contribute.</p> | ||
</div> | ||
</div> | ||
</div> | ||
</body> | ||
</html> |
Binary file added
BIN
+2.98 KB
deltatech_pricelist_add_category/static/description/logo-terrabit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+13.2 KB
deltatech_pricelist_add_category/static/description/main_screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 @@ | ||
from . import pricelist_wizard |
30 changes: 30 additions & 0 deletions
30
deltatech_pricelist_add_category/wizard/pricelist_wizard.py
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 @@ | ||
from odoo import fields, models | ||
|
||
|
||
class PricelistWizard(models.TransientModel): | ||
_name = "pricelist.wizard" | ||
_description = "Pricelist Wizard" | ||
|
||
public_category_id = fields.Many2one("product.public.category", string="Public Category", required=True) | ||
add_to_children = fields.Boolean(string="Add to Children Categories", default=True) | ||
|
||
def apply_category_to_products(self): | ||
pricelist_id = self.env.context.get("default_pricelist_id") | ||
if pricelist_id: | ||
pricelist = self.env["product.pricelist"].browse(pricelist_id) | ||
for line in pricelist.item_ids: | ||
if line.applied_on == "1_product" and line.product_tmpl_id: | ||
line.product_tmpl_id.write({"public_categ_ids": [(4, self.public_category_id.id)]}) | ||
elif line.applied_on == "2_product_category" and line.categ_id: | ||
self._add_category_to_products(line.categ_id, self.add_to_children) | ||
elif line.applied_on == "0_product_variant" and line.product_id: | ||
line.product_id.write({"public_categ_ids": [(4, self.public_category_id.id)]}) | ||
elif line.applied_on == "3_global": | ||
continue | ||
|
||
def _add_category_to_products(self, category, add_to_children): | ||
products = self.env["product.template"].search([("categ_id", "=", category.id)]) | ||
products.write({"public_categ_ids": [(4, self.public_category_id.id)]}) | ||
if add_to_children: | ||
for child_category in category.child_id: | ||
self._add_category_to_products(child_category, add_to_children) |
18 changes: 18 additions & 0 deletions
18
deltatech_pricelist_add_category/wizard/pricelist_wizard_view.xml
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,18 @@ | ||
<odoo> | ||
<record id="view_pricelist_wizard_form" model="ir.ui.view"> | ||
<field name="name">pricelist.wizard.form</field> | ||
<field name="model">pricelist.wizard</field> | ||
<field name="arch" type="xml"> | ||
<form string="Add Public Category"> | ||
<group> | ||
<field name="public_category_id" /> | ||
<field name="add_to_children" /> | ||
</group> | ||
<footer> | ||
<button string="Confirm" type="object" name="apply_category_to_products" class="btn-primary" /> | ||
<button string="Cancel" class="btn-secondary" special="cancel" /> | ||
</footer> | ||
</form> | ||
</field> | ||
</record> | ||
</odoo> |
1 change: 1 addition & 0 deletions
1
setup/deltatech_pricelist_add_category/odoo/addons/deltatech_pricelist_add_category
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 @@ | ||
../../../../deltatech_pricelist_add_category |
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={'odoo_version_override': '16.0'}, | ||
) |
1 change: 1 addition & 0 deletions
1
setup/deltatech_pricelist_add_categoty/odoo/addons/deltatech_pricelist_add_categoty
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 @@ | ||
../../../../deltatech_pricelist_add_categoty |
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={'odoo_version_override': '16.0'}, | ||
) |