Store product images on a disk

Odoo keeps product images in database. It can cause a problem if you have a lot of products with images and use @@html:<a href="/odoo/administration/2015/02/14/install-odoo.html">@@daily backup@@html:</a>@@

To store product images in filestore, I have created a module product_image_filestore. It uses ir.attachment table to store product images.

Repository: https://github.com/yelizariev/addons-yelizariev/tree/8.0/product\_image\_filestore

Warning

Installation or deleting this module will cause lost of your current product images. Before doing it you have to export images from all product variants and then import it back after installation or deleting the module.

Export images

Open Products menu, delete filters, select all products and click More / Export

Then add Image field to export and click Export to file. Do the same for Product variants:

  • Open Product Variants menu, delete filters, select all products and click More / Export (see @@html:<a href="/images/odoo/module/product_image_filestore-4.png">@@screenshot@@html:</a>@@).
  • Add Variant Image field to export and click Export to file (see @@html:<a href="/images/odoo/module/product_image_filestore-5.png">@@screenshot@@html:</a>@@).

Import images

After instaling or uninstalling module import images back. Open Products menu and click Import url. Then open your product.template.csv, click Validate and Import.

Do the same for with menu Product Variants and product.product.csv file (see @@html:<a href="/images/odoo/module/product_image_filestore-6.png">@@screenshot@@html:</a>@@)

issue "field larger than field limit (131072)"

During importing images, you can get error "field larger than field limit (131072)". It's a default restriction of a csv module. To fix it open file openerp/tools/convert.py and add csv.field_size_limit(sys.maxsize) after imports of a sys and csv modules. Like this:

import cStringIO
import csv
import logging
import os.path
import pickle
import re
import sys
csv.field_size_limit(sys.maxsize)

# for eval context:
import time

UPD I have made module that do it https://github.com/yelizariev/addons-yelizariev/tree/8.0/import\_csv\_fix\_field\_limit

Note for uninstalling

After unintalling this module you also have to update product module. This cause updating of all dependent modules.

0 Comments

Some integration of a company and its contacts

res_partner_company_stat

In odoo 8.0 new smart buttons were introduced: Some users expects, that in a company's form these buttons will search information about tasks, invoices, meetings etc. for whole company. But out-of-box buttons work only with records that are attached to company and not to company's contacts.

I have made module res_partner_company_stat to fix this issue. E.g. in "Calls" smart button you will get calls both for company and for company's contacts.

Repository: https://github.com/yelizariev/addons-yelizariev/tree/8.0/res\_partner\_company\_stat

res_partner_company_search

Another issue is search in contacts. With my module res_partner_company_search contacts are searched by company's fields also. E.g. you search contacts with a tag "Veterinary" and you get "child1" even if it doesn't have this tag, because his company does. (Out-of-box you will get in search results parent2 and child2 only).

Repository: https://github.com/yelizariev/addons-yelizariev/tree/8.0/res\_partner\_company\_search

0 Comments

Stock status in eCommerce

Unfortunately, odoo doesn't consider stock status of a products in eCommerce and customers are able to order out-of-stock items.

But on the other hand, the strength of the odoo is module structure to make modifications easily.

So, I've made a small module website_sale_stock_status to fix this issue.

The module adds automatic ribbons:

  • DISCONTINUED – stock is 0 and the status is End of Life or Obsolete.
  • BACKORDERED – stock is 0 and the status is Normal,

It also puts ribbons text at the product page and disables "Add to cart" feature if product is discontinued.

By default, stock status is updated every hour. It can be changed at Settings/Technical/Automation/Scheduled Actions

Repository: https://github.com/yelizariev/addons-yelizariev/tree/8.0/website\_sale\_stock\_status

0 Comments

Sentbox

Sometime odoo users want to have usual "Sent" mail box.

To implement it I've added new computed field:

self.sent = len(self.notified_partner_ids) > 1 \
            or len(self.notified_partner_ids)==1 \
            and self.notified_partner_ids[0].id != self.author_id.id

This field is need to filter out some messages (notifications) which don't have recepients.

This menu shows messages in threads (like in other menus), but shows only sent messages: Repository: https://github.com/yelizariev/addons-yelizariev/tree/8.0/mail\_sent

0 Comments

Last viewed records

SugarCRM shows last viewed records. Why not do the same in odoo? So, I did.

It allows easily navigate to recently pages.

For non-form view there is icon for type of view at the end of label.

For some models (e.g. Partner, Opportunity etc) special icon is shown.

This module doesn't affect on server performance, because it uses browser's localStorage to save history. But, of course, it means that history is not synced accross browsers.

Currently, very simple behavior is used:

  • New history item is added to first position only if it is not in history list
  • Last history item is removed if there are more than 8 items already.

Also, this module can be helpful for developers, because everytime you will have quick access to module page to install updates and access to page where you want to test something.

Enjoy!

Repository: https://github.com/yelizariev/addons-yelizariev/tree/8.0/_web_last_viewed_records

Update 20.03.2015. The module is now maintained by OCA!

Check out newest version here: https://github.com/OCA/web/tree/8.0/web_last_viewed_records

0 Comments