-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[ADD] sale_packaging_price: New module to assign a package price. #221
Conversation
I cannot test it, something wrong in runbot. Please could you review? Thanks |
|
||
To use this module, you need to: | ||
|
||
* go to warehause config and check 'Use packages: pallets, boxes, ...' and |
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.
s/warehause/warehouse
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.
This should be on Configuration section
Remove sale_packaging_price/i18n/.gitkeep |
action="action_product_packaging_form" | ||
parent="base.menu_product" sequence="99" /> | ||
</data> | ||
</openerp> |
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.
Remove extra spaces and put a line feed
You need to add product_packaging field to the form view. |
@@ -0,0 +1,30 @@ | |||
# -*- coding: utf-8 -*- |
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.
Why name it sale_stock.py instead sale_order.py?
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.
I rewrite function product_packaging_change that is located into sale_stock module in sale_stock.py file
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.
Upstream is wrong then: https://www.odoo.com/documentation/8.0/reference/guidelines.html
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.
No, it's not wrong. You should rename it to sale_order (model name, not module name).
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.
Quoting from there:
File naming: [...]
models/< inherited_main_model >.py
And class name is correct in CamelCase, also as guidelines say.
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.
I still don't know what's wrong with my proposal: rename it to sale_order.py
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.
Maybe it was a mistake, you said:
You should rename it to sale_order (model name, not module name).
The model name is SaleOrderLine
, correct.
Indeed the module should be sale_order.py
.
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.
No, the main model is sale.order, not sale.order.line, that's why I ask for sale_order.py
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.
Ah OK, I was understanding that you wanted him to rename the model! We agree then 😉
You have to also intercept product_id_change for handling changes on quantity. You should also prevent when packaging is selected, non multiple quantities. |
@rafaelbn @pedrobaeza Changes made |
* go to warehouse config and check 'Use packages: pallets, boxes, ...' and | ||
'Allow to define several packaging methods on products' | ||
|
||
* go to product and into procurement tab you can add new packages with a |
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.
This part is Usage section. I was talking about the other paragraph
@rafaelbn @pedrobaeza Chnges made |
👍 |
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/167/issues>`_. |
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.
167?
Testing in runbot, I created a package with 6 wine bottles (individual price would be 20€, pack price 100€). 100.02€ is not the price I set. To avoid this kind of problems, add a constraint that will not let the user to set an icompatible unit + package price combination. It will hassle them, but better hassle the user than the client. |
|
||
To use this module, you need to: | ||
|
||
* go to product and into procurement tab you can add new packages with a |
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.
It's in the inventory tab.
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.
Ok.
About the previous comment(100.02) you can increment the price decimal precision.
@yajo @pedrobaeza @rafaelbn Changes made. |
Much better, but still getting #221 (comment) though. Fix it and test it please. |
@yajo about #221 (comment) you can increment the price decimal precision. |
Not sure how to do that. Can you explain? Anyway, independently of the decimal precision, if you set a final price for a bundle of products, that should always be the final price. If the final price cannot be exactly matched because of the mix of quantity, price and decimal precision, then it should not allow to put that price in the first place. |
…cimal precision unit price
cc @pedrobaeza @yajo @rafaelbn @sergio-incaser |
The code looks good, but there is a new bug.
Error:
|
Seems to happen when qty = 0. When saving a wrong package price, the warning works as expected. |
@pedrobaeza @yajo @rafaelbn Changes made |
@pedrobaeza Changes made |
About this: #221 (comment) I agree with @yajo . Check: Setting -> Technical -> Database structure -> Decimal accuracy |
To solve problem of decimal precision please add in usage (even-though this is not the solution):
Been exactly: (maybe I need some illustration here)
Having this clear (I'm not sure if I have) the objective of module:
|
What do you think about this? #221 (comment) |
@sergio-incaser runbot is failing, could you please check it? thanks |
We have something for one customer, we based in the old product-pack of v6.1. You first define a service product as a bundle: and then you select which are their components: Then, because the first product is a service and there can be different VATs on the components in our case, we detail everything in the sale order but only the stock of the components is carried to the delivery order. But this module is not finished, because is intended to work with Magento connector and right now it's not possible to create from the ERP the sale order itself. We can upload the code anyway if you want. This is the way we would eventually solve your requirement, but I haven't look your solution. |
IMHO this solution is better integrated with current core Odoo. The notice of decimal precision seems fair enough to me. If you want 1.99€/pack, you will be warned, but not disabled to do it. |
Hi @liebana could you make a PR in https://github.com/OCA/product-attribute/tree/8.0 with that functionality? Module name could be product_pack, this could be better to compare. Ping us when done please, thanks. |
👍 to this PR, but @liebana's implementation is interesting too. Could you send it please? |
That module is in 8.0 in https://github.com/ingadhoc/odoo-addons/tree/8.0/product_pack, but it has the problems I mention here: OCA/product-attribute#6 (comment) |
Thanks! Tested in runbot 👍 |
[ADD] sale_packaging_price: New module to assign a package price.
This module was written to extends the functionality of sale workflow and allow you to assign a selling price of a complete package.
This price is split for having the price unit according the number of pieces that fits in that packaging, so there can be rounding issues to get the exact price that are warned if happens.