예제 #1
0
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU Affero General Public License for more details.
#
#    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 import orm, fields, osv
import openerp.addons.decimal_precision as dp
from openerp.tools.translate import _

from openerp.addons.product_price_history.product_price_history import PRODUCT_FIELD_HISTORIZE
PRODUCT_FIELD_HISTORIZE.extend(['duty_paid_cost', 'duty_free_cost', 'transit_cost'])


class product_duty_rule(orm.Model):
    _name = 'product.duty.rule'

    _columns = {
        'name': fields.char('Name', size=256, required=True, readonly=False),
        'company_id': fields.many2one('res.company', 'Company', required=False),
        'partner_id': fields.many2one(
            'res.partner', 'Default Supplier',
            domain=[('supplier', '=', True)],
            required=True),
        'active': fields.boolean(
            'Active',
            help="If the active field is set to false, "
예제 #2
0
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

from openerp.osv import orm, fields
import decimal_precision as dp
from openerp.addons.product_price_history.product_price_history import (
    PRODUCT_FIELD_HISTORIZE
)
import time
from datetime import datetime, timedelta
import logging
_logger = logging.getLogger(__name__)

# Add the field cost_price to the list of historized field per company
PRODUCT_FIELD_HISTORIZE.append('cost_price')


class product_product(orm.Model):
    _inherit = 'product.product'

    def _set_field_name_values(self, cr, uid, ids, field_name, context):
        field_flag = False
        field_dict = {}
        prod_tpl_obj = self.pool.get('product.template')
        if self._log_access:
            cr.execute('select id,write_date from ' +
                       self._table + ' where id IN %s', (tuple(ids),))
            res = cr.fetchall()
            for r in res:
                if r[1]:
예제 #3
0
# -*- coding: utf-8 -*-
# © 2014 Elico Corp (https://www.elico-corp.com)
# Licence AGPL-3.0 or later(http://www.gnu.org/licenses/agpl.html)

from openerp.osv import orm, fields, osv
import openerp.addons.decimal_precision as dp
from openerp.tools.translate import _

from openerp.addons.product_price_history.product_price_history import PRODUCT_FIELD_HISTORIZE
PRODUCT_FIELD_HISTORIZE.extend(
    ['duty_paid_cost', 'duty_free_cost', 'transit_cost'])


class product_duty_rule(orm.Model):
    _name = 'product.duty.rule'

    _columns = {
        'name':
        fields.char('Name', size=256, required=True, readonly=False),
        'company_id':
        fields.many2one('res.company', 'Company', required=False),
        'partner_id':
        fields.many2one('res.partner',
                        'Default Supplier',
                        domain=[('supplier', '=', True)],
                        required=True),
        'active':
        fields.boolean(
            'Active',
            help="If the active field is set to false, "
            "it will allow you to hide the duty rule without removing it."),
예제 #4
0
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

from openerp.osv import orm, fields
import decimal_precision as dp
from openerp.addons.product_price_history.product_price_history import (
    PRODUCT_FIELD_HISTORIZE)
import time
from datetime import datetime, timedelta
import logging

_logger = logging.getLogger(__name__)

# Add the field cost_price to the list of historized field per company
PRODUCT_FIELD_HISTORIZE.append('cost_price')


class product_product(orm.Model):
    _inherit = 'product.product'

    def _set_field_name_values(self, cr, uid, ids, field_name, context):
        field_flag = False
        field_dict = {}
        prod_tpl_obj = self.pool.get('product.template')
        if self._log_access:
            cr.execute(
                'select id,write_date from ' + self._table + ' where id IN %s',
                (tuple(ids), ))
            res = cr.fetchall()
            for r in res: