Example #1
0
class service_tax_rate(models.Model):
    _name = "l10n_eu_service.service_tax_rate"

    country_id = fields.Many2one('res.country', string='Country')
    rate = fields.Float(string="VAT Rate")
Example #2
0
class AccountConfigSettings(models.TransientModel):
    _name = 'account.config.settings'
    _inherit = 'res.config.settings'

    company_id = fields.Many2one('res.company',
                                 string='Company',
                                 required=True,
                                 default=lambda self: self.env.user.company_id)
    has_default_company = fields.Boolean(
        readonly=True,
        default=lambda self: self._default_has_default_company())
    expects_chart_of_accounts = fields.Boolean(
        related='company_id.expects_chart_of_accounts',
        string='This company has its own chart of accounts',
        help='Check this box if this company is a legal entity.')
    currency_id = fields.Many2one('res.currency',
                                  related='company_id.currency_id',
                                  required=True,
                                  string='Default company currency',
                                  help="Main currency of the company.")
    paypal_account = fields.Char(
        related='company_id.paypal_account',
        size=128,
        string='Paypal account',
        help=
        """Paypal account (email) for receiving online payments (credit card, etc.)
             If you set a paypal account, the customer  will be able to pay your invoices or quotations
             with a button \"Pay with  Paypal\" in automated emails or through the eCore portal."""
    )
    company_footer = fields.Text(
        related='company_id.rml_footer',
        string='Bank accounts footer preview',
        readonly=True,
        help="Bank accounts as printed in the footer of each printed document")

    has_chart_of_accounts = fields.Boolean(
        string='Company has a chart of accounts')
    chart_template_id = fields.Many2one('account.chart.template',
                                        string='Template',
                                        domain="[('visible','=', True)]")
    use_anglo_saxon = fields.Boolean(
        string='Use Anglo-Saxon Accounting',
        related='company_id.anglo_saxon_accounting')
    code_digits = fields.Integer(string='# of Digits',
                                 related='company_id.accounts_code_digits',
                                 help="No. of digits to use for account code")
    tax_calculation_rounding_method = fields.Selection(
        [
            ('round_per_line', 'Round calculation of taxes per line'),
            ('round_globally', 'Round globally calculation of taxes '),
        ],
        related='company_id.tax_calculation_rounding_method',
        string='Tax calculation rounding method',
        help=
        """If you select 'Round per line' : for each tax, the tax amount will first be
             computed and rounded for each PO/SO/invoice line and then these rounded amounts will be summed,
             leading to the total amount for that tax. If you select 'Round globally': for each tax,
             the tax amount will be computed for each PO/SO/invoice line, then these amounts will be
             summed and eventually this total tax amount will be rounded. If you sell with tax included,
             you should choose 'Round per line' because you certainly want the sum of your tax-included line
             subtotals to be equal to the total amount with taxes.""")
    sale_tax_id = fields.Many2one('account.tax.template',
                                  string='Default sale tax',
                                  oldname="sale_tax")
    purchase_tax_id = fields.Many2one('account.tax.template',
                                      string='Default purchase tax',
                                      oldname="purchase_tax")
    sale_tax_rate = fields.Float(string='Sales tax (%)')
    purchase_tax_rate = fields.Float(string='Purchase tax (%)')
    bank_account_code_prefix = fields.Char(
        string='Bank Accounts Prefix',
        related='company_id.bank_account_code_prefix',
        help='Define the code prefix for the bank accounts',
        oldname='bank_account_code_char')
    cash_account_code_prefix = fields.Char(
        string='Cash Accounts Prefix',
        related='company_id.cash_account_code_prefix',
        help='Define the code prefix for the cash accounts')
    template_transfer_account_id = fields.Many2one(
        'account.account.template',
        help=
        "Intermediary account used when moving money from a liquidity account to another"
    )
    transfer_account_id = fields.Many2one(
        'account.account',
        related='company_id.transfer_account_id',
        domain=lambda self: [
            ('reconcile', '=', True),
            ('user_type_id.id', '=',
             self.env.ref('account.data_account_type_current_assets').id)
        ],
        help=
        "Intermediary account used when moving money from a liquidity account to another"
    )
    complete_tax_set = fields.Boolean(
        string='Complete set of taxes',
        help=
        '''This boolean helps you to choose if you want to propose to the user to encode
             the sales and purchase rates or use the usual m2o fields. This last choice assumes that
             the set of tax defined for the chosen template is complete''')

    fiscalyear_last_day = fields.Integer(
        related='company_id.fiscalyear_last_day', default=31)
    fiscalyear_last_month = fields.Selection(
        [(1, 'January'), (2, 'February'), (3, 'March'), (4, 'April'),
         (5, 'May'), (6, 'June'), (7, 'July'), (8, 'August'), (9, 'September'),
         (10, 'October'), (11, 'November'), (12, 'December')],
        related='company_id.fiscalyear_last_month',
        default=12)
    period_lock_date = fields.Date(
        string="Lock Date for Non-Advisers",
        related='company_id.period_lock_date',
        help=
        "Only users with the 'Adviser' role can edit accounts prior to and inclusive of this date. Use it for period locking inside an open fiscal year, for example."
    )
    fiscalyear_lock_date = fields.Date(
        string="Lock Date",
        related='company_id.fiscalyear_lock_date',
        help=
        "No users, including Advisers, can edit accounts prior to and inclusive of this date. Use it for fiscal year locking for example."
    )

    module_account_accountant = fields.Boolean(
        string=
        'Full accounting features: journals, legal statements, chart of accounts, etc.',
        help=
        """If you do not check this box, you will be able to do invoicing & payments,
             but not accounting (Journal Items, Chart of  Accounts, ...)""")
    module_account_reports = fields.Boolean("Get dynamic accounting reports")
    group_multi_currency = fields.Boolean(
        string='Allow multi currencies',
        implied_group='base.group_multi_currency',
        help="Allows you multi currency environment")
    group_analytic_accounting = fields.Boolean(
        string='Analytic accounting',
        implied_group='analytic.group_analytic_accounting',
        help="Allows you to use the analytic accounting.")
    currency_exchange_journal_id = fields.Many2one(
        'account.journal',
        related='company_id.currency_exchange_journal_id',
        string="Rate Difference Journal",
    )
    module_account_asset = fields.Boolean(
        string='Assets management & Revenue recognition',
        help=
        'Asset management: This allows you to manage the assets owned by a company or a person. '
        'It keeps track of the depreciation occurred on those assets, and creates account move for those depreciation lines.\n\n'
        'Revenue recognition: This allows you to manage the Revenue recognition on selling product. '
        'It keeps track of the installment occurred on those revenue recognition, and creates account move for those installment lines.\n'
        '-This installs the module account_asset. If you do not check this box, you will be able to do invoicing & payments, '
        'but not accounting (Journal Items, Chart of Accounts, ...)')
    module_account_budget = fields.Boolean(
        string='Budget management',
        help=
        'This allows accountants to manage analytic and crossovered budgets. '
        'Once the master budgets and the budgets are defined, '
        'the project managers can set the planned amount on each analytic account.\n'
        '-This installs the module account_budget.')
    module_account_tax_cash_basis = fields.Boolean(
        string="Allow Tax Cash Basis",
        help='Generate tax cash basis entrie when reconciliating entries')

    group_proforma_invoices = fields.Boolean(
        string='Allow pro-forma invoices',
        implied_group='account.group_proforma_invoices',
        help="Allows you to put invoices in pro-forma state.")
    module_account_reports_followup = fields.Boolean(
        "Enable payment followup management",
        help=
        'This allows to automate letters for unpaid invoices, with multi-level recalls.\n'
        '-This installs the module account_reports_followup.')

    default_sale_tax_id = fields.Many2one(
        'account.tax',
        string="Default Sale Tax",
        help="This sale tax will be assigned by default on new products.",
        oldname="default_sale_tax")
    default_purchase_tax_id = fields.Many2one(
        'account.tax',
        string="Default Purchase Tax",
        help="This purchase tax will be assigned by default on new products.",
        oldname="default_purchase_tax")

    module_l10n_us_check_printing = fields.Boolean(
        "Allow check printing and deposits")

    module_account_batch_deposit = fields.Boolean(
        string='Use batch deposit',
        help=
        'This allows you to group received checks before you deposit them to the bank.\n'
        '-This installs the module account_batch_deposit.')
    module_account_sepa = fields.Boolean(
        string='Use SEPA payments',
        help=
        'If you check this box, you will be able to register your payment using SEPA.\n'
        '-This installs the module account_sepa.')

    module_account_plaid = fields.Boolean(
        string="Plaid Connector",
        help=
        'Get your bank statements from you bank and import them through plaid.com.\n'
        '-that installs the module account_plaid.')
    module_account_yodlee = fields.Boolean(
        "Bank Interface - Sync your bank feeds automatically",
        help=
        'Get your bank statements from your bank and import them through yodlee.com.\n'
        '-that installs the module account_yodlee.')
    module_account_bank_statement_import_qif = fields.Boolean(
        "Import .qif files",
        help=
        'Get your bank statements from your bank and import them in eCore in the .QIF format.\n'
        'This installs the module account_bank_statement_import_qif.')
    module_account_bank_statement_import_ofx = fields.Boolean(
        "Import in .ofx format",
        help=
        'Get your bank statements from your bank and import them in eCore in the .OFX format.\n'
        'This installs the module account_bank_statement_import_ofx.')

    @api.model
    def _default_has_default_company(self):
        count = self.env['res.company'].search_count([])
        return bool(count == 1)

    @api.onchange('company_id')
    def onchange_company_id(self):
        # update related fields
        self.currency_id = False
        if self.company_id:
            company = self.company_id
            self.chart_template_id = company.chart_template_id
            self.has_chart_of_accounts = len(
                company.chart_template_id) > 0 or False
            self.expects_chart_of_accounts = company.expects_chart_of_accounts
            self.currency_id = company.currency_id
            self.transfer_account_id = company.transfer_account_id
            self.paypal_account = company.paypal_account
            self.company_footer = company.rml_footer
            self.tax_calculation_rounding_method = company.tax_calculation_rounding_method
            self.bank_account_code_prefix = company.bank_account_code_prefix
            self.cash_account_code_prefix = company.cash_account_code_prefix
            self.code_digits = company.accounts_code_digits

            # update taxes
            ir_values = self.env['ir.values']
            taxes_id = ir_values.get_default('product.template',
                                             'taxes_id',
                                             company_id=self.company_id.id)
            supplier_taxes_id = ir_values.get_default(
                'product.template',
                'supplier_taxes_id',
                company_id=self.company_id.id)
            self.default_sale_tax_id = isinstance(
                taxes_id, list) and taxes_id[0] or taxes_id
            self.default_purchase_tax_id = isinstance(
                supplier_taxes_id,
                list) and supplier_taxes_id[0] or supplier_taxes_id
        return {}

    @api.onchange('chart_template_id')
    def onchange_chart_template_id(self):
        tax_templ_obj = self.env['account.tax.template']
        self.complete_tax_set = self.sale_tax_id = self.purchase_tax_id = False
        self.sale_tax_rate = self.purchase_tax_rate = 15
        if self.chart_template_id and not self.has_chart_of_accounts:
            # update complete_tax_set, sale_tax_id and purchase_tax_id
            self.complete_tax_set = self.chart_template_id.complete_tax_set
            if self.chart_template_id.complete_tax_set:
                ir_values_obj = self.env['ir.values']
                # default tax is given by the lowest sequence. For same sequence we will take the latest created as it will be the case for tax created while isntalling the generic chart of account
                sale_tax = tax_templ_obj.search(
                    [('chart_template_id', '=', self.chart_template_id.id),
                     ('type_tax_use', '=', 'sale')],
                    limit=1,
                    order="sequence, id desc")
                purchase_tax = tax_templ_obj.search(
                    [('chart_template_id', '=', self.chart_template_id.id),
                     ('type_tax_use', '=', 'purchase')],
                    limit=1,
                    order="sequence, id desc")
                self.sale_tax_id = sale_tax
                self.purchase_tax_id = purchase_tax
            if self.chart_template_id.code_digits:
                self.code_digits = self.chart_template_id.code_digits
            if self.chart_template_id.transfer_account_id:
                self.template_transfer_account_id = self.chart_template_id.transfer_account_id.id
            if self.chart_template_id.bank_account_code_prefix:
                self.bank_account_code_prefix = self.chart_template_id.bank_account_code_prefix
            if self.chart_template_id.cash_account_code_prefix:
                self.cash_account_code_prefix = self.chart_template_id.cash_account_code_prefix
        return {}

    @api.onchange('sale_tax_rate')
    def onchange_tax_rate(self):
        self.purchase_tax_rate = self.sale_tax_rate or False

    @api.multi
    def set_group_multi_currency(self):
        ir_model = self.env['ir.model.data']
        group_user = ir_model.get_object('base', 'group_user')
        group_product = ir_model.get_object('product', 'group_sale_pricelist')
        if self.group_multi_currency:
            group_user.write({'implied_ids': [(4, group_product.id)]})
        return True

    @api.multi
    def open_bank_accounts(self):
        action_rec = self.env['ir.model.data'].xmlid_to_object(
            'account.action_account_bank_journal_form')
        return action_rec.read([])[0]

    @api.multi
    def set_transfer_account(self):
        if self.transfer_account_id and self.transfer_account_id != self.company_id.transfer_account_id:
            self.company_id.write(
                {'transfer_account_id': self.transfer_account_id.id})

    @api.multi
    def set_product_taxes(self):
        """ Set the product taxes if they have changed """
        ir_values_obj = self.env['ir.values']
        ir_values_obj.sudo().set_default('product.template',
                                         "taxes_id",
                                         [self.default_sale_tax_id.id] if
                                         self.default_sale_tax_id else False,
                                         for_all_users=True,
                                         company_id=self.company_id.id)
        ir_values_obj.sudo().set_default(
            'product.template',
            "supplier_taxes_id", [self.default_purchase_tax_id.id]
            if self.default_purchase_tax_id else False,
            for_all_users=True,
            company_id=self.company_id.id)

    @api.multi
    def set_chart_of_accounts(self):
        """ install a chart of accounts for the given company (if required) """
        if self.chart_template_id and not self.has_chart_of_accounts and self.expects_chart_of_accounts:
            if self.company_id.chart_template_id and self.chart_template_id != self.company_id.chart_template_id:
                raise UserError(
                    _('You can not change a company chart of account once it has been installed'
                      ))
            wizard = self.env['wizard.multi.charts.accounts'].create({
                'company_id':
                self.company_id.id,
                'chart_template_id':
                self.chart_template_id.id,
                'transfer_account_id':
                self.template_transfer_account_id.id,
                'code_digits':
                self.code_digits or 6,
                'sale_tax_id':
                self.sale_tax_id.id,
                'purchase_tax_id':
                self.purchase_tax_id.id,
                'sale_tax_rate':
                self.sale_tax_rate,
                'purchase_tax_rate':
                self.purchase_tax_rate,
                'complete_tax_set':
                self.complete_tax_set,
                'currency_id':
                self.currency_id.id,
                'bank_account_code_prefix':
                self.bank_account_code_prefix,
                'cash_account_code_prefix':
                self.cash_account_code_prefix,
            })
            wizard.execute()

    @api.onchange('group_analytic_accounting')
    def onchange_analytic_accounting(self):
        if self.group_analytic_accounting:
            self.module_account_accountant = True

    @api.multi
    def open_company(self):
        return {
            'type': 'ir.actions.act_window',
            'name': 'My Company',
            'view_type': 'form',
            'view_mode': 'form',
            'res_model': 'res.company',
            'res_id': self.env.user.company_id.id,
            'target': 'current',
        }
Example #3
0
class AssetAssetReport(models.Model):
    _name = "asset.asset.report"
    _description = "Assets Analysis"
    _auto = False

    name = fields.Char(string='Year', required=False, readonly=True)
    date = fields.Date(readonly=True)
    depreciation_date = fields.Date(string='Depreciation Date', readonly=True)
    asset_id = fields.Many2one('account.asset.asset', string='Asset', readonly=True)
    asset_category_id = fields.Many2one('account.asset.category', string='Asset category', readonly=True)
    partner_id = fields.Many2one('res.partner', string='Partner', readonly=True)
    state = fields.Selection([('draft', 'Draft'), ('open', 'Running'), ('close', 'Close')], string='Status', readonly=True)
    depreciation_value = fields.Float(string='Amount of Depreciation Lines', readonly=True)
    installment_value = fields.Float(string='Amount of Installment Lines', readonly=True)
    move_check = fields.Boolean(string='Posted', readonly=True)
    installment_nbr = fields.Integer(string='# of Installment Lines', readonly=True)
    depreciation_nbr = fields.Integer(string='# of Depreciation Lines', readonly=True)
    gross_value = fields.Float(string='Gross Amount', readonly=True)
    posted_value = fields.Float(string='Posted Amount', readonly=True)
    unposted_value = fields.Float(string='Unposted Amount', readonly=True)
    company_id = fields.Many2one('res.company', string='Company', readonly=True)

    def init(self, cr):
        tools.drop_view_if_exists(cr, 'asset_asset_report')
        cr.execute("""
            create or replace view asset_asset_report as (
                select
                    min(dl.id) as id,
                    dl.name as name,
                    dl.depreciation_date as depreciation_date,
                    a.date as date,
                    (CASE WHEN dlmin.id = min(dl.id)
                      THEN a.value
                      ELSE 0
                      END) as gross_value,
                    dl.amount as depreciation_value,
                    dl.amount as installment_value,
                    (CASE WHEN dl.move_check
                      THEN dl.amount
                      ELSE 0
                      END) as posted_value,
                    (CASE WHEN NOT dl.move_check
                      THEN dl.amount
                      ELSE 0
                      END) as unposted_value,
                    dl.asset_id as asset_id,
                    dl.move_check as move_check,
                    a.category_id as asset_category_id,
                    a.partner_id as partner_id,
                    a.state as state,
                    count(dl.*) as installment_nbr,
                    count(dl.*) as depreciation_nbr,
                    a.company_id as company_id
                from account_asset_depreciation_line dl
                    left join account_asset_asset a on (dl.asset_id=a.id)
                    left join (select min(d.id) as id,ac.id as ac_id from account_asset_depreciation_line as d inner join account_asset_asset as ac ON (ac.id=d.asset_id) group by ac_id) as dlmin on dlmin.ac_id=a.id
                group by
                    dl.amount,dl.asset_id,dl.depreciation_date,dl.name,
                    a.date, dl.move_check, a.state, a.category_id, a.partner_id, a.company_id,
                    a.value, a.id, a.salvage_value, dlmin.id
        )""")
Example #4
0
class account_voucher_line(models.Model):
    _name = 'account.voucher.line'
    _description = 'Voucher Lines'

    @api.one
    @api.depends('price_unit', 'tax_ids', 'quantity', 'product_id',
                 'voucher_id.currency_id')
    def _compute_subtotal(self):
        self.price_subtotal = self.quantity * self.price_unit
        if self.tax_ids:
            taxes = self.tax_ids.compute_all(
                self.price_unit,
                self.voucher_id.currency_id,
                self.quantity,
                product=self.product_id,
                partner=self.voucher_id.partner_id)
            self.price_subtotal = taxes['total_excluded']

    name = fields.Text(string='Description', required=True)
    sequence = fields.Integer(
        default=10,
        help="Gives the sequence of this line when displaying the voucher.")
    voucher_id = fields.Many2one('account.voucher',
                                 'Voucher',
                                 required=1,
                                 ondelete='cascade')
    product_id = fields.Many2one('product.product',
                                 string='Product',
                                 ondelete='set null',
                                 index=True)
    account_id = fields.Many2one(
        'account.account',
        string='Account',
        required=True,
        domain=[('deprecated', '=', False)],
        help="The income or expense account related to the selected product.")
    price_unit = fields.Monetary(string='Unit Price',
                                 required=True,
                                 oldname='amount')
    price_subtotal = fields.Monetary(string='Amount',
                                     store=True,
                                     readonly=True,
                                     compute='_compute_subtotal')
    quantity = fields.Float(digits=dp.get_precision('Product Unit of Measure'),
                            required=True,
                            default=1)
    account_analytic_id = fields.Many2one('account.analytic.account',
                                          'Analytic Account')
    company_id = fields.Many2one('res.company',
                                 related='voucher_id.company_id',
                                 string='Company',
                                 store=True,
                                 readonly=True)
    tax_ids = fields.Many2many('account.tax',
                               string='Tax',
                               help="Only for tax excluded from price")
    currency_id = fields.Many2one('res.currency',
                                  related='voucher_id.currency_id')

    def _get_account(self, product, fpos, type):
        accounts = product.product_tmpl_id.get_product_accounts(fpos)
        if type == 'sale':
            return accounts['income']
        return accounts['expense']

    @api.multi
    def product_id_change(self,
                          product_id,
                          partner_id=False,
                          price_unit=False,
                          company_id=None,
                          currency_id=None,
                          type=None):
        context = self._context
        company_id = company_id if company_id is not None else context.get(
            'company_id', False)
        company = self.env['res.company'].browse(company_id)
        currency = self.env['res.currency'].browse(currency_id)
        if not partner_id:
            raise UserError(_("You must first select a partner!"))
        part = self.env['res.partner'].browse(partner_id)
        if part.lang:
            self = self.with_context(lang=part.lang)

        product = self.env['product.product'].browse(product_id)
        fpos = part.property_account_position_id.id
        account = self._get_account(product, fpos, type)
        values = {
            'name': product.partner_ref,
            'account_id': account.id,
        }

        if type == 'purchase':
            values['price_unit'] = price_unit or product.standard_price
            taxes = product.supplier_taxes_id or account.tax_ids
            if product.description_purchase:
                values['name'] += '\n' + product.description_purchase
        else:
            values['price_unit'] = product.lst_price
            taxes = product.taxes_id or account.tax_ids
            if product.description_sale:
                values['name'] += '\n' + product.description_sale

        values['tax_ids'] = taxes.ids

        if company and currency:
            if company.currency_id != currency:
                if type == 'purchase':
                    values['price_unit'] = product.standard_price
                values['price_unit'] = values['price_unit'] * currency.rate

        return {'value': values, 'domain': {}}
Example #5
0
class DeliveryCarrier(models.Model):
    _name = 'delivery.carrier'
    _inherits = {'product.product': 'product_id'}
    _description = "Carrier"
    _order = 'sequence, id'

    ''' A Shipping Provider

    In order to add your own external provider, follow these steps:

    1. Create your model MyProvider that _inherit 'delivery.carrier'
    2. Extend the selection of the field "delivery_type" with a pair
       ('<my_provider>', 'My Provider')
    3. Add your methods:
       <my_provider>_get_shipping_price_from_so
       <my_provider>_send_shipping
       <my_provider>_open_tracking_page
       <my_provider>_cancel_shipment
       (they are documented hereunder)
    '''

    # -------------------------------- #
    # Internals for shipping providers #
    # -------------------------------- #

    sequence = fields.Integer(help="Determine the display order", default=10)
    # This field will be overwritten by internal shipping providers by adding their own type (ex: 'fedex')
    delivery_type = fields.Selection([('fixed', 'Fixed Price'), ('base_on_rule', 'Based on Rules')], string='Price Computation', default='fixed', required=True)
    product_type = fields.Selection(related='product_id.type', default='service')
    product_sale_ok = fields.Boolean(related='product_id.sale_ok', default=False)
    partner_id = fields.Many2one('res.partner', string='Transporter Company', required=True, help="The partner that is doing the delivery service.")
    product_id = fields.Many2one('product.product', string='Delivery Product', required=True, ondelete="cascade")
    price = fields.Float(compute='get_price')
    available = fields.Boolean(compute='get_price')
    free_if_more_than = fields.Boolean('Free if Order total is more than', help="If the order is more expensive than a certain amount, the customer can benefit from a free shipping", default=False)
    amount = fields.Float(string='Amount', help="Amount of the order to benefit from a free shipping, expressed in the company currency")
    country_ids = fields.Many2many('res.country', 'delivery_carrier_country_rel', 'carrier_id', 'country_id', 'Countries')
    state_ids = fields.Many2many('res.country.state', 'delivery_carrier_state_rel', 'carrier_id', 'state_id', 'States')
    zip_from = fields.Char('Zip From')
    zip_to = fields.Char('Zip To')
    price_rule_ids = fields.One2many('delivery.price.rule', 'carrier_id', 'Pricing Rules', copy=True)
    fixed_price = fields.Float(compute='_compute_fixed_price', inverse='_set_product_fixed_price', store=True, string='Fixed Price',help="Keep empty if the pricing depends on the advanced pricing per destination")
    shipping_enabled = fields.Boolean(string="Shipping enabled", default=True, help="Uncheck this box to disable package shipping while validating Delivery Orders")

    @api.depends('product_id.list_price', 'product_id.product_tmpl_id.list_price')
    def _compute_fixed_price(self):
        for carrier in self:
            carrier.fixed_price = carrier.product_id.list_price

    def _set_product_fixed_price(self):
        for carrier in self:
            carrier.product_id.list_price = carrier.fixed_price

    @api.one
    def get_price(self):
        SaleOrder = self.env['sale.order']

        self.available = False
        self.price = False

        order_id = self.env.context.get('order_id')
        if order_id:
            # FIXME: temporary hack until we refactor the delivery API in master

            order = SaleOrder.browse(order_id)
            if self.delivery_type not in ['fixed', 'base_on_rule']:
                try:
                    self.price = self.get_shipping_price_from_so(order)[0]
                    self.available = True
                except UserError as e:
                    # No suitable delivery method found, probably configuration error
                    _logger.info("Carrier %s: %s, not found", self.name, e.name)
                    self.price = 0.0
            else:
                carrier = self.verify_carrier(order.partner_shipping_id)
                if carrier:
                    try:
                        self.price = carrier.get_price_available(order)
                        self.available = True
                    except UserError, e:
                        # No suitable delivery method found, probably configuration error
                        _logger.info("Carrier %s: %s", carrier.name, e.name)
                        self.price = 0.0
                else:
                    self.price = 0.0