-
-
Notifications
You must be signed in to change notification settings - Fork 603
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[16.0][MIG] pos_product_template: Migration to 16.0 #1170
base: 16.0
Are you sure you want to change the base?
Changes from 1 commit
4464eff
fcd1732
554d26a
4913648
d23864e
c5dab10
c5e9774
dfcb9fc
6bbeba8
d9d9de8
8bdd388
53600f9
6edf7ce
b177865
a52d4f1
7d8f4b9
e809f2e
811c430
45da370
0412733
460aa6c
16b12ad
f2367d7
21fb8c5
d68844b
b80bd06
d173d8a
3399c44
a675cf8
2d9f9e7
36dd811
25848d8
c6d4982
38084ec
54e7f2e
b1af776
2d94875
e14430d
282b34f
a87966f
63c0eb0
2240e90
00b98d8
e94eb83
aa29389
107e192
33a7109
0fcd36b
eb1be67
4c2808c
f48b395
de87176
4f28024
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
from . import pos_config | ||
from . import pos_session | ||
from . import res_config_settings |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,9 @@ class PosConfig(models.Model): | |
help="If selected the product variant selection screen will show the variants," | ||
" else it will only allow to confirm once all the attributes are chosen.", | ||
) | ||
|
||
iface_show_product_template = fields.Boolean( | ||
string="Shows product template in TPV", | ||
default=True, | ||
help="Enables product templates in TPV", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does'nt bring anything. |
||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
from odoo import api, models | ||
|
||
|
||
class PosSession(models.Model): | ||
_inherit = "pos.session" | ||
|
||
def _loader_params_pos_config(self): | ||
params = super()._loader_params_pos_config() | ||
if params.get("search_params", {}).get("fields"): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. test are not usefull here, as base function return search_params and fields. (otherwise, the PoS will not work at all...) |
||
params.get("search_params", {}).get("fields").extend( | ||
["iface_product_template_show_variants", "iface_show_product_template"] | ||
) | ||
return params | ||
|
||
@api.model | ||
def _pos_ui_models_to_load(self): | ||
models_to_load = super()._pos_ui_models_to_load() | ||
models_to_load.append("product.template") | ||
models_to_load.append("product.attribute") | ||
models_to_load.append("product.attribute.value") | ||
models_to_load.append("product.template.attribute.value") | ||
return models_to_load | ||
|
||
def _loader_params_product_product(self): | ||
params = super()._loader_params_product_product() | ||
params["search_params"]["fields"].append("name") | ||
params["search_params"]["fields"].append("product_template_attribute_value_ids") | ||
params["search_params"]["fields"].append("product_variant_count") | ||
return params | ||
|
||
def _get_pos_ui_product_template(self, params): | ||
return self.env["product.template"].search_read(**params["search_params"]) | ||
|
||
def _loader_params_product_template(self): | ||
return { | ||
"search_params": { | ||
"domain": [("sale_ok", "=", True), ("available_in_pos", "=", True)], | ||
"fields": [ | ||
"name", | ||
"display_name", | ||
"product_variant_ids", | ||
"product_variant_count", | ||
], | ||
}, | ||
} | ||
|
||
def _get_pos_ui_product_attribute(self, params): | ||
return self.env["product.attribute"].search_read(**params["search_params"]) | ||
|
||
def _loader_params_product_attribute(self): | ||
return { | ||
"search_params": { | ||
"fields": ["name", "value_ids", "sequence"], | ||
}, | ||
} | ||
|
||
def _get_pos_ui_product_attribute_value(self, params): | ||
return self.env["product.attribute.value"].search_read( | ||
**params["search_params"] | ||
) | ||
|
||
def _loader_params_product_attribute_value(self): | ||
return { | ||
"search_params": { | ||
"fields": ["name", "attribute_id"], | ||
}, | ||
} | ||
|
||
def _get_pos_ui_product_template_attribute_value(self, params): | ||
return self.env["product.template.attribute.value"].search_read( | ||
**params["search_params"] | ||
) | ||
|
||
def _loader_params_product_template_attribute_value(self): | ||
return { | ||
"search_params": { | ||
"domain": [("product_tmpl_id.available_in_pos", "=", True)], | ||
"fields": [ | ||
"name", | ||
"attribute_id", | ||
"product_tmpl_id", | ||
"product_attribute_value_id", | ||
"ptav_product_variant_ids", | ||
], | ||
}, | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from odoo import fields, models | ||
|
||
|
||
class ResConfigSettings(models.TransientModel): | ||
_inherit = "res.config.settings" | ||
|
||
iface_product_template_show_variants = fields.Boolean( | ||
related="pos_config_id.iface_product_template_show_variants", readonly=False | ||
) | ||
|
||
iface_show_product_template = fields.Boolean( | ||
related="pos_config_id.iface_show_product_template", readonly=False | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
Go to "Point of Sale > Configurations > Settings" and select the option "Show product template in PoS". | ||
|
||
Open the Point of Sale, search an article with variants. | ||
You will see one article instead of all the variants. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TPV is not english.
as it is in pos_config, I guess "Show Product Templates" is enough.