def write(self, cr, uid, ids, vals, context=None):
     Model.write(self, cr, uid, ids,vals,context=context)
     if vals['default_brand']:
         cr.execute('Update kderp_brand_name set \
                             default_brand=False\
                         where product_id=(Select product_id from kderp_brand_name where id=%s) and id<>%s' % (ids[0],ids[0]))
     return True
 def create(self,cr, uid, vals, context=None):
     new_id = False
     new_id=Model.create(self,cr, uid, vals, context)
     if vals['default_brand'] and vals['product_id'] and new_id:
         cr.execute('Update kderp_brand_name set \
                             default_brand=False\
                         where product_id=%s and id<>%s' % (vals['product_id'],new_id))
     return new_id
Exemple #3
0
 def fields_get(self, req, model):
     Model = req.session.model(model)
     fields = Model.fields_get(False, req.session.eval_context(req.context))
     return fields
 def create(self, cr, uid, vals, context={}):        
     id_test=Model.create(self, cr, uid, vals, context=context)
     new_id=self.pool.get('kderp.contract.currency').create_currency(cr,uid,id_test,context)
     self.pool.get('ir.rule').clear_cache(cr,uid)
     return id_test
Exemple #5
0
#
#    You should have received a copy of the GNU Affero General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp.osv.orm import Model, BaseModel, fields, except_orm, FIELDS_TO_PGTYPES, LOG_ACCESS_COLUMNS  # MetaModel,  Model, TransientModel, AbstractModel
import types
import openerp.tools as tools

import logging
_logger = logging.getLogger(__name__)
_schema = logging.getLogger(__name__ + '.schema')

Model._sequence = 'ir_serial_id_seq'

for sub_class  in Model.__subclasses__():
    sub_class._sequence = 'ir_serial_id_seq'

from openerp.addons.base.ir.ir_actions import *
ir_actions_act_client._sequence = 'ir_serial_id_seq'
ir_actions_report_xml._sequence = 'ir_serial_id_seq'
ir_actions_act_window._sequence = 'ir_serial_id_seq'
ir_actions_act_url._sequence = 'ir_serial_id_seq'
ir_actions_server._sequence = 'ir_serial_id_seq'
ir_server_object_lines._sequence = 'ir_serial_id_seq'

FIELDS_TO_PGTYPES[fields.integer] = 'int8'  # DECOD.IO
FIELDS_TO_PGTYPES[fields.many2one] = 'int8'  # DECOD.IO

LOG_ACCESS_COLUMNS['create_uid'] = "BIGINT REFERENCES res_users ON DELETE RESTRICT"
LOG_ACCESS_COLUMNS['create_date'] = "TIMESTAMP without time zone DEFAULT (now() AT TIME ZONE 'UTC')"