-
-
Notifications
You must be signed in to change notification settings - Fork 781
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] account_asset_management_stock_lot #2022
base: 16.0
Are you sure you want to change the base?
Conversation
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.
very interesting module 💯
@@ -100,7 +100,7 @@ | |||
<field name="date_remove" /> | |||
</group> | |||
</group> | |||
<group string="Other Information"> | |||
<group string="Other Information" name="general_info"> |
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 would separate this change into a different commit, to have one per module.
|
||
{ | ||
"name": "Assets Management Stock Lot", | ||
"version": "16.0.1.2.5", |
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.
"version": "16.0.1.2.5", | |
"version": "16.0.1.0.0", |
0.0
in the first version
<field name="arch" type="xml"> | ||
<xpath expr="//group[@name='general_info']" position="inside"> | ||
<group> | ||
<field name="product_id" /> |
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.
<field name="product_id" /> | |
<field name="product_id" attrs="{'invisible': [('stock_lot_id', '=', False)]}" /> |
WDYT about hiding the product when there is still no lot assigned?
</xpath> | ||
</field> | ||
</record> | ||
</odoo> |
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.
another possible improvement would be to add the corresponding tree and search views
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.
Code review 👍 . Pending changes to be approved
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.
LGTM, I would let the user to pick the product first and then show the possible lots filtered, if you have many lots with the same number for different products it would be hard to choose one.
It would also be nice another glue module with the account_move_line_product so the product is set in the journal item and it is transferred to the asset. But I guess that is for another PR.
Thank you.
@florian-dacosta, We're interested to migrate this module to 17.0 once this is approved! I created the migration PR here in draft: #2024. I already added the changes that you're being suggested in this commit: ccd2b17 👍 . |
Thanks for the remarks,
That is a good question. The problem is I am not sure we want to have an asset linked to a product but no lot ? Would the following would be a good idea for you :
(Like I said, I feel like if we create an asset for a product we manage in stock, we need to identify exactly which are the product concerned. If the product is configured with lot, we should have 1 asset for the lot, but the lot could concerned a large quantity of product) In my use case, it only concerns serial number for now, that is why I am not so sure about how to act with lot numbe (I don't have any use case for this yet). We can also leave a lot more flexibility in the module, and make it ok to have any number of asset for a same lot number, or even allowing to link an asset to a product without lot? I am not sure |
Hi @florian-dacosta, thanks for the reply and the input. 😄 IHMO, what you're describing makes sense to me, in a way that we should have the assets linked to only one lot/serial number, any of the two. In that sense, we should have the user inputting the lot / serial number on the asset, to then have the product computed as you are describing, which should not be editable, it should just be displayed for information purposes. I agree on the fact that you should have described the specific stock unit to the asset, but not a generic one. Then, according to said above, I would continue suggesting the same changes I have as pending. |
I have cherry-pick the commit with the pending suggestion. |
653a5ad
to
c9ad69e
Compare
compute="_compute_product_id", | ||
store=True, | ||
) | ||
stock_lot_id = fields.Many2one("stock.lot", string="Lot") |
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.
stock_lot_id = fields.Many2one("stock.lot", string="Lot") | |
stock_lot_id = fields.Many2one("stock.lot", string="Lot/Serial Number") |
Maybe we could update the name to follow the Odoo way? https://github.com/odoo/odoo/blob/17.0/addons/stock/models/stock_move_line.py#L49
WDYT? 😄
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.
What is the Odoo way ? lot_id
?
I am not sure, because we are on an account
model.
You would not name a many2one toward stock.move
move_id
on account.asset
for instance, but you would name it stock_move_id
, right ?
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.
Hi @florian-dacosta, I was only mentioning the string
attribute to be changed, see in the suggestion. For the field name, I guess they are all fine already 👍🏿
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, I'll rename the string
c9ad69e
to
f287e5e
Compare
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.
LGTM, functional and code review 👍🏿
thanks for attending the suggestions 😄
Yes, totally agree. If the product is selected then the lot should be mandatory. In any case, for now, let's keep it as it is and then we can add more complexity later on if needed. My use case deals with serial numbers only. |
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.
Code review
@AaronHForgeFlow @GuillemCForgeFlow @AndreuOForgeFlow On my side, I am not sure on what should/could go in this module or in an other one, I guess it could help to check if your need are similar. I need to :
That is basically all I need. More concrete use case using all this is the following. |
My use case is similar.
|
The goal here is to link a serial number with an asset in case you have some assets that you also manage in stock.
It is the case for instance (in France at least) when you rent some product instead of selling it, you can choose to create an asset.
This module does not do much right now, it is more about to have the right data model to implement more stuff, but it allow at least to filter your asset by serial number.