How to confirm multiple sale order in Odoo 10? - odoo

I am new to python but I am willing to learn :)
Basically I need to have a menu for confirming multiple sale order in Odoo 10.
So far I found this How to add entry to 'More' menu or top menu to add action on multiple selections? However I am not sure if it is the same for Odoo 10.
I found this code in sale.py
#api.multi
def action_confirm(self):
for order in self:
order.state = 'sale'
order.confirmation_date = fields.Datetime.now()
if self.env.context.get('send_email'):
self.force_quotation_send()
order.order_line._action_procurement_create()
if self.env['ir.values'].get_default('sale.config.settings', 'auto_done_setting'):
self.action_done()
return True
if the above code is can be used for confirming multiple sale orders then all I need is to have extra menu which uses it.
Any pointers on this would be greatly appreciated.

This module may help you https://www.odoo.com/apps/modules/10.0/sale_order_mass_confirm/
It is available in odoo apps.

Related

Odoo 12: KeyError: 'ir.values'

I m trying to create a new contact in odoo application but it shows me this error :
KeyError: 'ir.values'
The issue is related with this funtion.
class ResPartner(models.Model):
_inherit = 'res.partner'
def _default_credit_limit(self):
return self.env['ir.values'].get_default('account.config.settings', 'credit_limit')
I don't understand the problem
Can you please help me
KeyError: 'ir.values'
If you run self.env['ir.values'] on Odoo 12, you will get the above error because the ir.values Model does not exist in Odoo 12.
The ir.values Model was removed and replaced with ir.default. For example:
self.env['ir.default'].get('sale.order', 'sale_order_template_id')
You can see the relevant file in the Odoo core code or the commit where most of that Model was added.
Are you sure that this setting even exists anymore? I don't know for sure, but couldn't find it, i'm aware in Odoo 8 it existed. Beside the fact, that i don't think it exists anymore: account.config.settings don't exist for 100% sure, because the settings model was refactored into res.config.settings.
Actually the partner field credit_limit is gone, too. So if you want to use it and have a default outside the code, use ir.default for your desired behaviour.

Add supplier code to purchase order line

How can i add a the field suppliercode to my purchase.order.line model in odoo
GUI
In the report i was able to do it with
<span t-field="line.product_id.seller_ids and line.product_id.seller_ids[0].product_code"/>
(not my solution, found it on stackoverflow)
Do I use it like in the picture or in server actions
You should create simple compute field in purchase order line.
#api.multi
def get_supplier_code(self):
product_supplier_info_obj=self.env['product.supplierinfo']
for line in self:
purchase_order=line.order_id
supplier_info=product_supplier_info_obj.search([('product_tmpl_id','=',line.product_id.product_tmpl_id.id),('name','=',purchase_order.partner_id.id)],limit=1)
line.product_code=supplier_info.product_code
product_code=fields.Char(compute="get_supplier_code",store=False,string="purchase Code")
This may help you.

How to display only selected products in Spree?

Am using Spree Commerce, and right now every product I add on my backend is displayed on the homepage. Is there a way that I can display only products of my choice on the frontpage, and not display everything as it does by default?
I know deface allows me to customise the look of everything, but it is not the answer I am looking for.
Thanks
#elliot Actually it's pretty simple. Go to product's edit page on admin end and set discontinue_on for that product with a date equal to the current date or lesser.
Only those product are visible on the frontend for which available_on is lesser than the current date and discontinue_on is greater than the current date.
Deface is used to changing views not a controllers. A fetching products from DB is a controller logic.
There is a lot of options, you can add your own scopes in product model and override controller to use them, but fastest is use discontinue_on because for not admin user spree uses usually active scope on products.
Found the answer: I just changed #products = #searcher.retrieve_products to #products = Product.joins(:variants_including_master).where(:name => "Ruby on Rails Tote").uniq on my index action in home_controller_decorator.rb

Does Prestashop auto manages the product quantity when products are purchased?

Sorry for asking this here, on Prestashop forum I dont get any replays. And sorry for my english.
In order to explain my problem I will make a simple example:
product "X product" in stock are 10 items. (quantity = 10)
when some one adds one item to card and purchase it, i think it is logically that quantity will become 9.
on my website it remains 10. Why?
Or at list the quantity must change when order become FINISHED/ APPROVED...
Who can give me some tips how I must configure my prestashop in order to achive the wanted result?
Your shop may be in the mode digital product management.
Here is a possible answer. Go to your backend > Preferences > Products.
Scroll down to the end of the page. In the group of configuration 'Product stocks', make sure that you have activate the option 'Activate stock management'. It may solve your issue.
I hope it helps.

How do I share "advanced filters" in OpenERP 6.1?

How do I share "advanced filters" in OpenERP 6.1? Is there some way to have GLOBAL advanced filters that everyone can use?
Their no direct way you can do this but alternate way is :
Create Filter and Goto "Settings/Customization/Low Level Objects/Actions/Filters"
Now Duplicate the filter and Change user of the new duplicate filter
But this does works Perfect with OpenERP 7.0 as You need.
Thank You
In OpenERP 6.1, go to the "filters" drop-down list and select "manage filters". Then click on the one you want to share globally to display its form view. Then, empty the "User" field. This will make this filter available to all users.
in class ir_filters(osv.osv):
Change this function to read.
def get_filters(self, cr, uid, model):
act_ids = self.search(cr,uid,[('model_id','=',model),'|',('user_id','=',uid),('user_id','=',False)])
my_acts = self.read(cr, uid, act_ids, ['name', 'domain','context'])
return my_acts
Then leave the user blank