Exemple #1
0
class product_template(osv.osv):
    _name = 'product.template'
    _inherit = 'product.template'
    _columns = {
        'property_stock_procurement':
        fields.property(
            'stock.location',
            type='many2one',
            relation='stock.location',
            string="Procurement Location",
            view_load=True,
            domain=[('usage', 'like', 'procurement')],
            help=
            "For the current product, this stock location will be used, instead of the default one, as the source location for stock moves generated by procurements"
        ),
        'property_stock_production':
        fields.property(
            'stock.location',
            type='many2one',
            relation='stock.location',
            string="Production Location",
            view_load=True,
            domain=[('usage', 'like', 'production')],
            help=
            "For the current product, this stock location will be used, instead of the default one, as the source location for stock moves generated by production orders"
        ),
        'property_stock_inventory':
        fields.property(
            'stock.location',
            type='many2one',
            relation='stock.location',
            string="Inventory Location",
            view_load=True,
            domain=[('usage', 'like', 'inventory')],
            help=
            "For the current product, this stock location will be used, instead of the default one, as the source location for stock moves generated when you do an inventory"
        ),
        'property_stock_account_input':
        fields.property(
            'account.account',
            type='many2one',
            relation='account.account',
            string='Stock Input Account',
            view_load=True,
            help=
            "When doing real-time inventory valuation, counterpart journal items for all incoming stock moves will be posted in this account, unless "
            "there is a specific valuation account set on the source location. When not set on the product, the one from the product category is used."
        ),
        'property_stock_account_output':
        fields.property(
            'account.account',
            type='many2one',
            relation='account.account',
            string='Stock Output Account',
            view_load=True,
            help=
            "When doing real-time inventory valuation, counterpart journal items for all outgoing stock moves will be posted in this account, unless "
            "there is a specific valuation account set on the destination location. When not set on the product, the one from the product category is used."
        ),
    }
class product_template(osv.osv):
    """add functionally for differentiate miscible product and not miscible product"""
    _inherit = "product.template"

    _columns = {
        'property_raw':
        fields.property(
            'stock.location',
            type='many2one',
            relation='stock.location',
            string="Raw Materials Location",
            method=True,
            view_load=True,
            help=
            "For the current product (template), this stock location will be used, instead of the default one, as the source where search the products needs for a production of this product (template)."
        ),
        'property_mix':
        fields.property(
            'stock.location',
            type='many2one',
            relation='stock.location',
            string='Mix Moves Location',
            method=True,
            view_load=True,
            help="Location where will go the products that form a mix")
    }
Exemple #3
0
class product_category(osv.osv):

    _inherit = 'product.category'
    _columns = {
        'property_stock_journal': fields.property('account.journal',
            relation='account.journal', type='many2one',
            string='Stock journal', view_load=True,
            help="When doing real-time inventory valuation, this is the Accounting Journal in which entries will be automatically posted when stock moves are processed."),
        'property_stock_account_input_categ': fields.property('account.account',
            type='many2one', relation='account.account',
            string='Stock Input Account', view_load=True,
            help="When doing real-time inventory valuation, counterpart journal items for all incoming stock moves will be posted in this account, unless "
                 "there is a specific valuation account set on the source location. This is the default value for all products in this category. It "
                 "can also directly be set on each product"),
        'property_stock_account_output_categ': fields.property('account.account',
            type='many2one', relation='account.account',
            string='Stock Output Account', view_load=True,
            help="When doing real-time inventory valuation, counterpart journal items for all outgoing stock moves will be posted in this account, unless "
                 "there is a specific valuation account set on the destination location. This is the default value for all products in this category. It "
                 "can also directly be set on each product"),
        'property_stock_valuation_account_id': fields.property('account.account',
            type='many2one',
            relation='account.account',
            string="Stock Valuation Account",
            view_load=True,
            help="When real-time inventory valuation is enabled on a product, this account will hold the current value of the products.",),
    }
Exemple #4
0
class res_partner(osv.osv):
    _inherit = 'res.partner'

    _columns = {
        'property_account_prepayable':
        fields.property(
            'account.account',
            type='many2one',
            relation='account.account',
            string="Account Payable (Prepayment)",
            view_load=True,
            domain="[('type', '=', 'payable')]",
            help=
            "This account will be used instead of the default one as the prepayment payable account for the current partner",
            required=True),
        'property_account_prereceivable':
        fields.property(
            'account.account',
            type='many2one',
            relation='account.account',
            string="Account Receivable (Prepayment)",
            view_load=True,
            domain="[('type', '=', 'receivable')]",
            help=
            "This account will be used instead of the default one as the prepayment receivable account for the current partner",
            required=True),
    }
Exemple #5
0
class product_template(osv.osv):
    _name = 'product.template'
    _inherit = 'product.template'
    _columns = {
        'property_account_cost_center':
        fields.property(
            'account.account',
            type='many2one',
            relation='account.account',
            string="Cost Center Account",
            method=True,
            view_load=True,
            help=
            "This account will be used to value cost center for the current product"
        ),
        'property_account_charges':
        fields.property(
            'account.account',
            type='many2one',
            relation='account.account',
            string="Charges Account",
            method=True,
            view_load=True,
            help=
            "This account will be used to value charges for the current product"
        ),
    }
Exemple #6
0
class product_category(osv.osv):
    _name = "product.category"
    _inherit = "product.category"

    _columns = {
        'tms_property_account_income_categ':
        fields.property(
            'account.account',
            type='many2one',
            relation='account.account',
            string="Breakdown Income Account",
            view_load=True,
            help=
            "Use this to define breakdown income account per vehicle for Freights, Moves, Insurance, etc."
        ),
        'tms_property_account_expense_categ':
        fields.property(
            'account.account',
            type='many2one',
            relation='account.account',
            string="Breakdown Expense Account",
            view_load=True,
            help=
            "Use this to define breakdown expense account per vehicle for Fuel, Travel Expenses, etc."
        ),
    }
Exemple #7
0
class product_category(osv.osv):
    _inherit = "product.category"
    _columns = {
        'property_account_income_categ':
        fields.property(
            'account.account',
            type='many2one',
            relation='account.account',
            string="Income Account",
            method=True,
            view_load=True,
            help=
            "This account will be used for invoices to value sales for the current product category"
        ),
        'property_account_expense_categ':
        fields.property(
            'account.account',
            type='many2one',
            relation='account.account',
            string="Expense Account",
            method=True,
            view_load=True,
            help=
            "This account will be used for invoices to value expenses for the current product category"
        ),
    }
class product_category(osv.osv):
    _inherit = 'product.category'
    _columns = {
        'acc_prod_id': fields.property('account.product',
            type='many2one', relation='account.product',
            string='Product Accounting Classification', method=True, view_load=True,
            help='This account will be used to value the output stock'),
        'property_account_allowance': fields.property(
            'account.account',
            type='many2one',
            relation='account.account',
            string="Allowance Account",
            method=True,
            view_load=True,
            help="This account will be used to book Allowances when making Customer Refunds."),
        'property_account_return': fields.property(
            'account.account',
            type='many2one',
            relation='account.account',
            string="Sale Return Account",
            method=True,
            view_load=True,
            help="This account will be used to book Sale Returns when making Customer Refunds."),
        'unique_account':fields.boolean(
            'Require Unique Account', 
            help='Selecting this field allow you to create Unique Accounts for this Record, Taking into Account the Accounting Classification, not doing so, Will asign those ones in the Product Category' ),
    }
Exemple #9
0
class res_users(osv.osv):
    _name = 'res.users'
    _inherit = 'res.users'

    _columns = {
        'context_def_purpose_printer':
        fields.property('aeroo.printers',
                        type='many2one',
                        relation='aeroo.printers',
                        string='Default Genreral Purpose Printer',
                        method=True,
                        view_load=True,
                        domain='[("code","not in",%s)]' %
                        str(SPECIAL_PRINTERS),
                        help="",
                        required=False),
        'context_def_label_printer':
        fields.property('aeroo.printers',
                        type='many2one',
                        relation='aeroo.printers',
                        string='Default Label Printer',
                        method=True,
                        view_load=True,
                        domain='[("code","not in",%s)]' %
                        str(SPECIAL_PRINTERS),
                        help="",
                        required=False),
    }
Exemple #10
0
class product_template(osv.osv):
    _inherit = "product.template"
    _description = "Product Template"
    _columns = {
        'list_price':
        fields.property(
            'product.template',
            type='float',
            string='Public Price',
            method=True,
            view_load=True,
            required=True,
            help=
            "Base price for computing the customer price. Sometimes called the catalog price."
        ),
        'standard_price':
        fields.property(
            'product.template',
            type='float',
            string='Standard Price',
            method=True,
            view_load=True,
            required=True,
            help=
            "Product's cost for accounting stock valuation. It is the base price for the supplier price."
        ),
    }
Exemple #11
0
class res_partner_account(osv.osv):
    
    _inherit = 'res.partner.account' 
    
    _columns = {
        'property_parent_advance': fields.property(
            'account.account',
            type='many2one',
            relation='account.account',
            string="Cuenta Anfitriona",
            method=True,
            view_load=True,
            domain="[('type', '=', 'view'),('level','=',level),('level','>',0)]",
            help='',
            required=True,
            readonly=False),
        'property_account_advance_default': fields.property(
            'account.account',
            type='many2one',
            relation='account.account',
            string="Cuenta Contable por Defecto",
            method=True,
            view_load=True,
            domain="[('type', '!=', 'view'),('parent_id', '=', property_account_advance), ('company_id', '=', company_id), ('reconcile', '=', True), ('user_type', '=', user_type_advance), ('type', '=', type),]",
            help='',
            required=True,
            readonly=False),
        'user_type_advance': fields.many2one(
            'account.account.type',
            'Tipo de Cuenta',
            required=True, ondelete='restrict'),
        }    
Exemple #12
0
class product_template(osv.osv):
    _inherit = "product.template"
    _columns = {
        'taxes_id':
        fields.many2many('account.tax',
                         'product_taxes_rel',
                         'prod_id',
                         'tax_id',
                         'Product Taxes',
                         domain=[('parent_id', '=', False)]),
        'property_account_income_europe':
        fields.property(
            'account.account',
            type='many2one',
            relation='account.account',
            string="Income Account for Europe",
            method=True,
            view_load=True,
            group_name="Accounting Properties",
            help=
            "This account will be used, instead of the default one, to value incoming stock for the current product"
        ),
        'property_account_expense_europe':
        fields.property(
            'account.account',
            type='many2one',
            relation='account.account',
            string="Expense Account for Europe",
            method=True,
            view_load=True,
            group_name="Accounting Properties",
            help=
            "This account will be used, instead of the default one, to value outgoing stock for the current product"
        ),
        'property_account_income_world':
        fields.property(
            'account.account',
            type='many2one',
            relation='account.account',
            string="Outside Europe Income Account",
            method=True,
            view_load=True,
            group_name="Accounting Properties",
            help=
            "This account will be used, instead of the default one, to value incoming stock for the current product"
        ),
        'property_account_expense_world1':
        fields.property(
            'account.account',
            type='many2one',
            relation='account.account',
            string="Outside Europe Expense Account",
            method=True,
            view_load=True,
            group_name="Accounting Properties",
            help=
            "This account will be used, instead of the default one, to value outgoing stock for the current product"
        ),
    }
Exemple #13
0
class admin_affairs_account(osv.osv):
    """To manage admin affairs account """
    _name = "admin_affairs.account"

    _description = 'Admin Affairs Account'

    _rec_name = "model_id"


    def _model_ids(self,cr,uid,context=None):
        List = []
        model_obj = self.pool.get("ir.model")
        search_ids = model_obj.search(cr,uid,[],context=context)
        for mo in model_obj.browse(cr,uid,search_ids,context=context):
            modules = mo.modules.split(',')
            flag = 'service' in modules or 'fleet' in modules
            flag = flag or 'admin_affairs' in modules or 'fuel_management' in modules 
            if flag:
                List.append( str(mo.id))
        return List


    def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
        """ Returns views and fields for current model.
        @param cr: A database cursor
        @param user: ID of the user currently logged in
        @param view_id: list of fields, which required to read signatures
        @param view_type: defines a view type. it can be one of (form, tree, graph, calender, gantt, search, mdx)
        @param context: context arguments, like lang, time zone
        @param toolbar: contains a list of reports, wizards, and links related to current model

        @return: Returns a dictionary that contains definition for fields, views, and toolbars
        """
        if not context:
            context = {}
        res = super(admin_affairs_account, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu)

        for field in res['fields']:
            if field == 'model_id':
                res['fields'][field]['domain'] = [('id','in',
                    self._model_ids(cr,uid,context=context)),('osv_memory','=',False)]
        return res

    _columns = {
        'model_id': fields.many2one('ir.model','Model',required=True),
        'journal_id': fields.property('account.journal', required=True,type='many2one', relation='account.journal',
                                      string='Journal', method=True, view_load=True),                        
        'account_id': fields.property('account.account',type='many2one', relation='account.account', 
                                      string='Account', method=True, view_load=True,required=True),
        'analytic_id': fields.property('account.analytic.account', type='many2one', relation='account.analytic.account',
                                       string='Analytic Account', method=True, view_load=True),
        'notes': fields.text('Notes', size=256 ), 

    }

    _sql_constraints = [
        ('model_uniq', 'unique(model_id)', _('The Model Must Be Unique For Each Service!')),
    ]
Exemple #14
0
class product_category(osv.osv):
    _inherit = "product.category"
    _columns = {
        'property_account_income_europe':
        fields.property(
            'account.account',
            type='many2one',
            relation='account.account',
            string="Income Account for Europe",
            method=True,
            view_load=True,
            group_name="Accounting Properties",
            help=
            "This account will be used, instead of the default one, to value incoming stock for the current product"
        ),
        'property_account_expense_europe':
        fields.property(
            'account.account',
            type='many2one',
            relation='account.account',
            string="Expense Account for Europe",
            method=True,
            view_load=True,
            group_name="Accounting Properties",
            help=
            "This account will be used, instead of the default one, to value outgoing stock for the current product"
        ),
        'property_account_income_world':
        fields.property(
            'account.account',
            type='many2one',
            relation='account.account',
            string="Outside Europe Income Account",
            method=True,
            view_load=True,
            group_name="Accounting Properties",
            help=
            "This account will be used, instead of the default one, to value incoming stock for the current product"
        ),
        'property_account_expense_world':
        fields.property(
            'account.account',
            type='many2one',
            relation='account.account',
            string="Outside Europe Expense Account",
            method=True,
            view_load=True,
            group_name="Accounting Properties",
            help=
            "This account will be used, instead of the default one, to value outgoing stock for the current product"
        ),
    }
Exemple #15
0
class product_product(osv.osv):
    """
    To manage fule products """

    _inherit = "product.product"

    _columns = {
        'fuel_ok':
        fields.boolean(
            'Fuel product',
            help=
            "By checking the fuel field, you determine this product as fuel"),
        'fuel_type':
        fields.selection([('gasoline', 'Gasoline'), ('petrol', 'Petrol')],
                         'Fuel type'),
        'property_fuel_fixed':
        fields.property(
            'stock.location',
            type='many2one',
            relation='stock.location',
            string="Fuel fixed Location",
            view_load=True,
            domain=[('fuel_location', '=', True), ('usage', '=', 'internal')],
            help=
            "For the current product, this stock location will be used as the location for fixed fuel"
        ),
        'property_fuel_extra':
        fields.property(
            'stock.location',
            type='many2one',
            relation='stock.location',
            string="Fuel Extra Location",
            view_load=True,
            domain=[('fuel_location', '=', True), ('usage', '=', 'internal')],
            help=
            "For the current product, this stock location will be used as the location for extra fuel"
        ),
        'property_fuel_customer':
        fields.property(
            'stock.location',
            type='many2one',
            relation='stock.location',
            string="Fuel customer location",
            view_load=True,
            domain=[('usage', '=', 'customer')],
            help=
            "For the current product, this stock location will be used as output location for the fuel"
        ),
    }
class hr_employee(osv.osv):
    '''
    Employee
    '''
    _inherit = 'hr.employee'
    _description = 'Employee'

    _columns = {
        'property_bank_account':
        fields.property(
            'account.account',
            type='many2one',
            relation='account.account',
            string="Bank Account",
            method=True,
            domain="[('type', '=', 'liquidity')]",
            view_load=True,
            help=
            "Select Bank Account from where Salary Expense will be Paid, to be used for payslip verification."
        ),
        'salary_account':
        fields.property(
            'account.account',
            type='many2one',
            relation='account.account',
            string="Salary Account",
            method=True,
            domain="[('type', '=', 'other')]",
            view_load=True,
            help="Expense account when Salary Expense will be recorded"),
        'employee_account':
        fields.property('account.account',
                        type='many2one',
                        relation='account.account',
                        string="Employee Account",
                        method=True,
                        domain="[('type', '=', 'other')]",
                        view_load=True,
                        help="Employee Payable Account"),
        'analytic_account':
        fields.property('account.analytic.account',
                        type='many2one',
                        relation='account.analytic.account',
                        string="Analytic Account",
                        method=True,
                        view_load=True,
                        help="Analytic Account for Salary Analysis"),
    }
Exemple #17
0
class res_partner(osv.osv):

    _inherit = 'res.partner'

    _description = ''

    ##-------------------------------------------------------------------------

    ##------------------------------------------------------- _internal methods

    ##--------------------------------------------------------- function fields

    _columns = {
        'property_patent':
        fields.property(None,
                        method=True,
                        type='char',
                        string='Municipal patent',
                        size=32,
                        help="Municipal tax patent number"),
    }

    _defaults = {}

    _sql_constraints = []
Exemple #18
0
class l10n_pe_4ta_suspension(osv.Model):
    _name = "l10n_pe_4ta.suspension"
    _columns = {
            'partner_id': fields.many2one('res.partner', string="Partner", required=True),
            'property_fiscalyear_id': fields.property('account.fiscalyear',
                                                      relation='account.fiscalyear',
                                                      type='many2one' ,
                                                      view_load=True,
                                                      string="fiscal Year", required=True),
            'name': fields.char('Order Number',16),
            'application_result': fields.selection([('valid','Valid'),
                                                    ('invalid','Invalid')], string='Application Result', required=True),
            'application_date': fields.date('Application Date'),
            'application_end': fields.date('Application End'),
        }
    _defaults = {
            'application_result': 'valid',
            'application_date': lambda *a: time.strftime('%Y-%m-%d'),
            'property_fiscalyear_id': lambda s,cr,u,c: s.pool.get('account.fiscalyear').find(cr,u,context=c),
            'application_end': lambda s,cr,u,c: s.pool.get('account.fiscalyear').browse(cr,u,s.pool.get('account.fiscalyear').find(cr,u,context=c),context=c).date_stop,
        }
    _sql_constraints = [('partner_name_uniq','unique(partner_id,name)', 
                         'Partner and order number must be unique!')]
    
    def name_get(self, cr, uid, ids, context=None):
        if not ids:
            return []
        if context is None: context = {}
        return [(r['id'], (str("[%s%s] %s"%(r.property_fiscalyear_id.name,r.name and (' - '+r.name) or '',r.partner_id.name)) or '')) for r in self.browse(cr, uid, ids, context=context)]
Exemple #19
0
class sale_shop(osv.osv):
    _inherit = 'sale.shop'
    _columns = {
        'pos_user_id': fields.many2one('res.users', 'POS User'),
        'product_customer_id': fields.many2one('product.product', 'Product for Fidelity Card', domain="[('type', '=', 'service')]"),
        'fiscal_position_id': fields.many2one('account.fiscal.position', 'Fiscal Position', domain="[('customer', '=', True)]"),
        'property_account_receivable': fields.property(
            'account.account',
            type='many2one',
            relation='account.account',
            string="Account Receivable",
            view_load=True,
            domain="[('type', '=', 'receivable')]",
            help="This account will be used instead of the default one as the receivable account for the current shop" ),
    }

    _defaults = {
        'pos_user_id': lambda obj, cr, uid, context: uid,
    }

    _sql_constraints = [
        ('pos_user_id_uniq', 'unique(pos_user_id)', 'iPos User must be unique!'),
    ]

    def copy(self, cr, uid, id, default=None, context=None):
        default = default or {}
        default.update({
            'pos_user_id': False,
        })
        return super(sale_shop, self).copy(cr, uid, id, default, context)
class product_product(osv.osv):
    _inherit = 'product.product'
    _columns = {
                'property_fiscal_classification': fields.property(
                    'account.product.fiscal.classification',
                    type='many2one',
                    relation='account.product.fiscal.classification',
                    string="Fiscal Classification",
                    method=True,
                    view_load=True,
                    help="Company wise (eg localizable) Fiscal Classification"),
                }

    def fiscal_classification_id_change(self, cr, uid, ids, fiscal_classification_id=False, sale_tax_ids=[[6, 0, []]], purchase_tax_ids=[[6, 0, []]]):
        """We eventually keep the sale and purchase taxes because those are not company wise in OpenERP. So if we choose a different fiscal position
        for a different company, we don't want to override other's companies setting"""
        result = {'value':{}}
        if fiscal_classification_id:
            fiscal_classification = self.pool.get('account.product.fiscal.classification').browse(cr, uid, fiscal_classification_id)

            current_company_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.id
            to_keep_sale_tax_ids = self.pool.get('account.tax').search(cr, uid, [('id', 'in', sale_tax_ids[0][2]), ('company_id', '!=', current_company_id)])
            to_keep_purchase_tax_ids = self.pool.get('account.tax').search(cr, uid, [('id', 'in', purchase_tax_ids[0][2]), ('company_id', '!=', current_company_id)])

            result['value']['taxes_id'] = to_keep_sale_tax_ids + [x.id for x in fiscal_classification.sale_base_tax_ids]
            result['value']['supplier_taxes_id'] = to_keep_purchase_tax_ids + [x.id for x in fiscal_classification.purchase_base_tax_ids]
        return result
Exemple #21
0
class res_company(osv.osv):
    _inherit = "res.company"
    _columns = {
        'paypal_account':
        fields.char(
            "Paypal Account",
            size=128,
            help=
            "Paypal username (usually email) for receiving online payments."),
        'overdue_msg':
        fields.text('Overdue Payments Message', translate=True),
        'property_reserve_and_surplus_account':
        fields.property(
            'account.account',
            type='many2one',
            relation='account.account',
            string="Reserve and Profit/Loss Account",
            view_load=True,
            domain="[('type', '=', 'other')]",
            help=
            "This account is used for transferring Profit/Loss (If It is Profit: Amount will be added, Loss : Amount will be deducted.), as calculated in Profit & Loss Report"
        ),
    }

    _defaults = {
        'overdue_msg':
        '''Our records indicate that the following payments are still due. If the amount
has already been paid, please disregard this notice. However, if you have any
queries regarding your account, please contact us.
Thank you in advance.
'''
    }
Exemple #22
0
class res_company(osv.osv):
    _inherit = "res.company"
    _columns = {
        'overdue_msg':
        fields.text('Overdue Payments Message', translate=True),
        'property_reserve_and_surplus_account':
        fields.property(
            'account.account',
            type='many2one',
            relation='account.account',
            string="Reserve and Profit/Loss Account",
            method=True,
            view_load=True,
            domain="[('type', '=', 'other')]",
            help=
            "This Account is used for transferring Profit/Loss(If It is Profit: Amount will be added, Loss : Amount will be deducted.), Which is calculated from Profit & Loss Report"
        ),
    }

    _defaults = {
        'overdue_msg':
        'Please note that the following payments are now due. If your payment \
                        has been sent, kindly forward your payment details. If payment will be \
                        delayed further, please contact us to discuss. \
                        \nWould your payment have been carried out after this mail was sent, please consider the present one as void.'
    }
class product_product(osv.osv):
    """
    Adds the new property field 'requires_sample_library' for Quality Control templates for Lots: generic and
    specific templates for input and produced lots. If they are empty, the lots 
    won't require to pass test.
    The generic templates get it's default value from company.
    """
    _inherit = 'product.product'

    # product.product
    def _search_by_requires_sample_library(self, cr, uid, obj, name, args,
                                           context):
        property_proxy = self.pool.get('ir.property')

        res = []
        for fieldname, operator, condition in args:
            opposite = False
            if operator in ('!=', '<>'):
                operator = '='
                opposite = True

            prop_ids = property_proxy.search(
                cr,
                uid, [
                    ('name', '=', fieldname),
                    ('res_id', 'like', 'res.partner,%'),
                    ('value_integer', operator, condition),
                ],
                context=context)

            product_ids = []
            for property in property_proxy.browse(cr, uid, prop_ids, context):
                product_ids.append(property.res_id.id)

            operator = 'in'
            if opposite:
                operator = 'not in'
            res.append(('id', operator, product_ids))
        return res

    _columns = {
        'requires_sample_library':
        fields.property('product.product',
                        type='boolean',
                        string="Requires Sample Library",
                        method=True,
                        view_load=True,
                        fnct_search=_search_by_requires_sample_library),
    }

    # product.product
    def _default_requires_sample_library(self, cr, uid, context):
        user = self.pool.get('res.users').browse(cr, uid, uid, context)
        return user.company_id.requires_sample_library

    _defaults = {
        'requires_sample_library': _default_requires_sample_library,
    }
Exemple #24
0
class product_template(osv.osv):
    _inherit = 'product.template'
    _columns = {
        'property_stock_location': fields.property('stock.location',
            relation='stock.location', type='many2one',
            string='Stock Location', method=True, view_load=True,
            help="This location will be proposed as source (sale,internal) or target (purchase,production) location for stock move for this product."\
                 "Leave empty if you want to use the location of this product category"),
    }
class res_partner(osv.osv):

    _inherit = 'res.partner'
    _name = 'res.partner'

    _columns = {
        'property_account_efectos_cartera':
        fields.property(
            'account.account',
            type='many2one',
            relation='account.account',
            string="Efectos Comerciales en Cartera",
            method=True,
            view_load=True,
            domain="[('type', '=', 'receivable')]",
            help=
            "Esta cuenta será utilizada en lugar de la cuenta por defecto del diario para registrar los efectos comerciales en cartera",
            required=False),
        'property_account_impagos':
        fields.property(
            'account.account',
            type='many2one',
            relation='account.account',
            string="Impagos",
            method=True,
            view_load=True,
            domain="[('type', '=', 'receivable')]",
            help=
            "Esta cuenta será utilizada en lugar de la cuenta por defecto del diario para registrar los efectos impagados",
            required=False),
        'property_account_efectos_incobrables':
        fields.property(
            'account.account',
            type='many2one',
            relation='account.account',
            string="Incobrables",
            method=True,
            view_load=True,
            domain="[('type', '=', 'other')]",
            help=
            "Esta cuenta será utilizada en lugar de la cuenta por defecto para registrar los efectos incobrables",
            required=False),
    }
Exemple #26
0
class res_partner(osv.osv):
    _inherit = 'res.partner'
    _columns = {
        'property_stock_customer': fields.property(
          'stock.location',
          type='many2one',
          relation='stock.location',
          string="Customer Location",
          view_load=True,
          help="This stock location will be used, instead of the default one, as the destination location for goods you send to this partner"),

        'property_stock_supplier': fields.property(
          'stock.location',
          type='many2one',
          relation='stock.location',
          string="Supplier Location",
          view_load=True,
          help="This stock location will be used, instead of the default one, as the source location for goods you receive from the current partner"),
    }
Exemple #27
0
class account_payment_term_line(osv.osv):
    _inherit = "account.payment.term.line"

    _columns = {
        'is_discount':
        fields.related('payment_id',
                       'is_discount',
                       type='boolean',
                       string='Is Cash Discount',
                       readonly=True),
        'discount':
        fields.float(
            'Discount (%)',
            digits=(4, 2),
        ),
        'discount_income_account_id':
        fields.property(
            'account.account',
            type='many2one',
            relation='account.account',
            string='Discount Income Account',
            view_load=True,
            help="This account will be used to post the cash discount income"),
        'discount_expense_account_id':
        fields.property(
            'account.account',
            type='many2one',
            relation='account.account',
            string='Discount Expense Account',
            view_load=True,
            help="This account will be used to post the cash discount expense"
        ),
    }

    def onchange_discount(self, cr, uid, ids, discount):
        if not discount: return {}
        result = {}
        result = {
            'value': {
                'value_amount': round(1 - (discount / 100.0), 2),
            }
        }
        return result
Exemple #28
0
class product_template(osv.osv):
    _inherit = "product.template"
    _columns = {
        'taxes_id':
        fields.many2many('account.tax',
                         'product_taxes_rel',
                         'prod_id',
                         'tax_id',
                         'Customer Taxes',
                         domain=[('parent_id', '=', False),
                                 ('type_tax_use', 'in', ['sale', 'all'])]),
        'supplier_taxes_id':
        fields.many2many('account.tax',
                         'product_supplier_taxes_rel',
                         'prod_id',
                         'tax_id',
                         'Supplier Taxes',
                         domain=[('parent_id', '=', False),
                                 ('type_tax_use', 'in', ['purchase', 'all'])]),
        'property_account_income':
        fields.property(
            'account.account',
            type='many2one',
            relation='account.account',
            string="Income Account",
            method=True,
            view_load=True,
            help=
            "This account will be used for invoices instead of the default one to value sales for the current product"
        ),
        'property_account_expense':
        fields.property(
            'account.account',
            type='many2one',
            relation='account.account',
            string="Expense Account",
            method=True,
            view_load=True,
            help=
            "This account will be used for invoices instead of the default one to value expenses for the current product"
        ),
    }
Exemple #29
0
class res_partner(osv.osv):
    _inherit = 'res.partner'
    _columns = {
        'payment_type_customer':
        fields.property('payment.type',
                        type='many2one',
                        relation='payment.type',
                        string='Customer Payment Type',
                        method=True,
                        view_load=True,
                        help="Payment type of the customer"),
        'payment_type_supplier':
        fields.property('payment.type',
                        type='many2one',
                        relation='payment.type',
                        string='Supplier Payment Type',
                        method=True,
                        view_load=True,
                        help="Payment type of the supplier"),
    }
Exemple #30
0
class account_account(osv.osv):
    _name = 'account.account'
    _inherit = 'account.account'
    _columns = {
        'property_account_debit' : fields.property(
											'account.account',
											type = 'many2one',
											relation='account.account',
											string="Debit Account",
											method=True,
											view_load=True,
											help="This account will be used to make another journal entry as debit account"),
        'property_account_credit' : fields.property(
											'account.account',
											type = 'many2one',
											relation='account.account',
											string="Credit Account",
											method=True,
											view_load=True,
											help="This account will be used to make another journal entry as creditt account"),
    }