The best channel for tricks in odoo. I always look forward to the next video because I know I will learn something useful. Thank you for your time. I have a question about this video: How can the warning message be translated? Our team uses two languages. Also if you can make a video on how to translate the employees name please. We issue invoices in two languages and it is not convenient to have the employee's name in Cyrillic on an English invoice.
Great video! Would there be a way to slightly modify this to just pop up a warning but not stop you from saving? Something like the customer reference field on a sales order typically shouldn’t have duplicates, but there are scenarios that they do and it’s acceptable.
Thank you! It can complicate the process, yes. Depending on which fields they change or rename with version upgrades, it may or may not complicate the upgrade.
Thanks for your videos! I have a few questions, firstly, on odoo17, i am not able to restrict sale of out of stock item, how can i solve this issue?, secondly, i use a user login for multiple retail locations and sell on POS module with different employees, is it possible to create employee/sales person log in for Sales module?
Glad to help. You can restrict sales on e-commerce, but on the rest, I’d setup a check with an automation. For the separate user, I haven’t found a way to track a universal variable like the currently logged in user. Let me think on that.
The two solutions I can think of off the top of my head would be to either require the field as they input a sale or you could potentially do something with the ip address.
Hi , thanks for the tutorial! The code works for preventing duplicate contacts, but I face an issue: the error also appears when selecting an existing contact in other modules like Inventory. How can I make the validation apply only during contact creation or editing? Appreciate your help!
I am trying to adapt this script to verify if certain fields are filled in on invoices, and then display a warning or even pre-fill certain fields. The odd thing is, when saving an invoice, account.move seems to do multiple operations (sale.order does the same thing). Logging env.context shows that one of the operations holds the old data, and this makes checking on invoices or sale orders not work as elegantly as shown here on the contacts model. i.e. when a field is empty, in my case fiscal_position_id, I display a warning, but then when the user correctly fills out the field, the warning still comes up, because the first background operation has the old data which was empty.. Do you have any tips how I might capture the actual filled in data, and bypass the old data ? I'm also trying to understand what exactly is happening with the multiple operations when saving an invoice.. I have no other automated actions in place...
Hmmm...that's strange that you would have that kind of barrier. Are you specifically wanting a warning or are you just trying to stop people from moving forward if certain information isn't filled out? You can conditionally require fields and that will stop a user from moving forward till those fields are filled out.
@@odoo-it-yourself I should perhaps do some further testing on a fresh database, but in both cases (just a warning or preventing going further) the same thing happens, even when I type a value in a field that is being checked in python, upon save there is always this 'old data' in the payload which is the previous-unfilled field, and this always triggers the condition.. it's a bit frustrating. It works perfectly on products and contacts for example, but on sales orders or invoices not. If I ever find a workaround, I'll post it here.
you can also do something like this (the _sendone function may be different depending on which odoo version you are using) : sent_messages = set() for msg in messages: if msg and msg not in sent_messages: record.env['bus.bus']._sendone( (record._cr.dbname, 'res.partner', record.env.user.partner_id.id), 'simple_notification', { 'title': 'Message Title', 'message': msg, 'sticky': True, } ) sent_messages.add(msg)
Nice tips and tricks, thanks for sharing :)
Glad to help!
The best channel for tricks in odoo. I always look forward to the next video because I know I will learn something useful. Thank you for your time.
I have a question about this video: How can the warning message be translated? Our team uses two languages.
Also if you can make a video on how to translate the employees name please. We issue invoices in two languages and it is not convenient to have the employee's name in Cyrillic on an English invoice.
I've never worked with creating the warning in different languages. That's a great idea for a video! Let me look into that.
Great video! Would there be a way to slightly modify this to just pop up a warning but not stop you from saving? Something like the customer reference field on a sales order typically shouldn’t have duplicates, but there are scenarios that they do and it’s acceptable.
So I'm looking into doing a video on a wizard you could get past. I've never done it before, but I think there's a way you could do it.
Thanks for the video! Amazing Job ❤ quick question: does adding code like this prevent odoo from automatically updating its version?
Thank you! It can complicate the process, yes. Depending on which fields they change or rename with version upgrades, it may or may not complicate the upgrade.
Thanks for your videos! I have a few questions, firstly, on odoo17, i am not able to restrict sale of out of stock item, how can i solve this issue?, secondly, i use a user login for multiple retail locations and sell on POS module with different employees, is it possible to create employee/sales person log in for Sales module?
Glad to help. You can restrict sales on e-commerce, but on the rest, I’d setup a check with an automation. For the separate user, I haven’t found a way to track a universal variable like the currently logged in user. Let me think on that.
The two solutions I can think of off the top of my head would be to either require the field as they input a sale or you could potentially do something with the ip address.
🎉The best
Thank you!
Hi , thanks for the tutorial! The code works for preventing duplicate contacts, but I face an issue: the error also appears when selecting an existing contact in other modules like Inventory. How can I make the validation apply only during contact creation or editing? Appreciate your help!
Hmmm...I'm trying to think how that's triggering it. It shouldn't be creating a contact.
I am trying to adapt this script to verify if certain fields are filled in on invoices, and then display a warning or even pre-fill certain fields.
The odd thing is, when saving an invoice, account.move seems to do multiple operations (sale.order does the same thing).
Logging env.context shows that one of the operations holds the old data, and this makes checking on invoices or sale orders not work as elegantly as shown here on the contacts model.
i.e. when a field is empty, in my case fiscal_position_id, I display a warning, but then when the user correctly fills out the field, the warning still comes up, because the first background operation has the old data which was empty..
Do you have any tips how I might capture the actual filled in data, and bypass the old data ?
I'm also trying to understand what exactly is happening with the multiple operations when saving an invoice.. I have no other automated actions in place...
Hmmm...that's strange that you would have that kind of barrier. Are you specifically wanting a warning or are you just trying to stop people from moving forward if certain information isn't filled out? You can conditionally require fields and that will stop a user from moving forward till those fields are filled out.
@@odoo-it-yourself I should perhaps do some further testing on a fresh database, but in both cases (just a warning or preventing going further) the same thing happens, even when I type a value in a field that is being checked in python, upon save there is always this 'old data' in the payload which is the previous-unfilled field, and this always triggers the condition.. it's a bit frustrating. It works perfectly on products and contacts for example, but on sales orders or invoices not.
If I ever find a workaround, I'll post it here.
How could you add a button on the warning screen that says 'Ignore warning' and save the record?
Good question! For that, you would want to pop up a wizard. ua-cam.com/video/hrQZ-O_tKRs/v-deo.html
you can also do something like this (the _sendone function may be different depending on which odoo version you are using) :
sent_messages = set()
for msg in messages:
if msg and msg not in sent_messages:
record.env['bus.bus']._sendone(
(record._cr.dbname, 'res.partner', record.env.user.partner_id.id),
'simple_notification',
{
'title': 'Message Title',
'message': msg,
'sticky': True,
}
)
sent_messages.add(msg)
is there a way to set this warning to the customers who are buying a product and with that creating new account?
Hmmm...a warning to say they already have an account? Do you have open signup setup? If so, it shouldn't allow them to create another account.
GOAT!!!
Hahaha...glad it's helpful!
How much the line of code will cost in odoo online
You don't have to buy that coverage, if you don't want to.
useful 👍
Thank you!