Exemple #1
0
class pos_config(osv.osv):
    _inherit = 'pos.config'
    _columns = {
        'iface_splitbill':
        fields.boolean('Bill Splitting',
                       help='Enables Bill Splitting in the Point of Sale'),
        'iface_printbill':
        fields.boolean('Bill Printing',
                       help='Allows to print the Bill before payment'),
        'iface_orderline_notes':
        fields.boolean('Orderline Notes',
                       help='Allow custom notes on Orderlines'),
        'floor_ids':
        fields.one2many(
            'restaurant.floor',
            'pos_config_id',
            'Restaurant Floors',
            help='The restaurant floors served by this point of sale'),
        'printer_ids':
        fields.many2many('restaurant.printer',
                         'pos_config_printer_rel',
                         'config_id',
                         'printer_id',
                         string='Order Printers'),
    }
    _defaults = {
        'iface_splitbill': False,
        'iface_printbill': False,
    }
Exemple #2
0
class wizard_price(osv.osv):
    _name = "wizard.price"
    _description = "Compute price wizard"
    _columns = {
        'info_field':
        fields.text('Info', readonly=True),
        'real_time_accounting':
        fields.boolean("Generate accounting entries when real-time"),
        'recursive':
        fields.boolean("Change prices of child BoMs too"),
    }

    def default_get(self, cr, uid, fields, context=None):
        res = super(wizard_price, self).default_get(cr,
                                                    uid,
                                                    fields,
                                                    context=context)
        product_pool = self.pool.get('product.template')
        product_obj = product_pool.browse(cr, uid,
                                          context.get('active_id', False))
        if context is None:
            context = {}
        rec_id = context and context.get('active_id', False)
        assert rec_id, _('Active ID is not set in Context.')
        computed_price = product_pool.compute_price(
            cr,
            uid, [],
            template_ids=[product_obj.id],
            test=True,
            context=context)
        if product_obj.id in computed_price:
            res['info_field'] = "%s: %s" % (product_obj.name,
                                            computed_price[product_obj.id])
        else:
            res['info_field'] = ""
        return res

    def compute_from_bom(self, cr, uid, ids, context=None):
        assert len(ids) == 1
        if context is None:
            context = {}
        model = context.get('active_model')
        if model != 'product.template':
            raise UserError(
                _('This wizard is build for product templates, while you are currently running it from a product variant.'
                  ))
        rec_id = context and context.get('active_id', False)
        assert rec_id, _('Active ID is not set in Context.')
        prod_obj = self.pool.get('product.template')
        res = self.browse(cr, uid, ids, context=context)
        prod = prod_obj.browse(cr, uid, rec_id, context=context)
        prod_obj.compute_price(
            cr,
            uid, [],
            template_ids=[prod.id],
            real_time_accounting=res[0].real_time_accounting,
            recursive=res[0].recursive,
            test=False,
            context=context)
class hr_employee_be(osv.osv):
    _inherit = 'hr.employee'

    _columns = {
        'spouse_fiscal_status': fields.selection([('without income','Without Income'),('with income','With Income')], 'Tax status for spouse'),
        'disabled_spouse_bool': fields.boolean('Disabled Spouse', help="if recipient spouse is declared disabled by law"),
        'disabled_children_bool': fields.boolean('Disabled Children', help="if recipient children is/are declared disabled by law"),
        'resident_bool': fields.boolean('Nonresident', help="if recipient lives in a foreign country"),
        'disabled_children_number': fields.integer('Number of disabled children'),
    }
class wizard_valuation_history(osv.osv_memory):

    _name = 'wizard.valuation.history'
    _description = 'Wizard that opens the stock valuation history table'
    _columns = {
        'choose_date': fields.boolean('Inventory at Date'),
        'date': fields.datetime('Date', required=True),
    }

    _defaults = {
        'choose_date': False,
        'date': fields.datetime.now,
    }

    def open_table(self, cr, uid, ids, context=None):
        if context is None:
            context = {}
        data = self.read(cr, uid, ids, context=context)[0]
        ctx = context.copy()
        ctx['history_date'] = data['date']
        ctx['search_default_group_by_product'] = True
        ctx['search_default_group_by_location'] = True
        return {
            'domain': "[('date', '<=', '" + data['date'] + "')]",
            'name': _('Stock Value At Date'),
            'view_type': 'form',
            'view_mode': 'tree',
            'res_model': 'stock.history',
            'type': 'ir.actions.act_window',
            'context': ctx,
        }
Exemple #5
0
class pos_configuration(osv.TransientModel):
    _inherit = 'res.config.settings'
    _name = 'pos.config.settings'

    _columns = {
        'module_pos_restaurant': fields.selection([
            (0, "Point of sale for shops"),
            (1, "Restaurant: activate table management")
            ], "Restaurant",
            help='This module adds several restaurant features to the Point of Sale: \n\n- Bill Printing: Allows you to print a receipt before the order is paid \n\n- Bill Splitting: Allows you to split an order into different orders \n\n- Kitchen Order Printing: allows you to print orders updates to kitchen or bar printers'),
        'module_pos_loyalty': fields.boolean("Loyalty Program",
            help='Allows you to define a loyalty program in the point of sale, where the customers earn loyalty points and get rewards'),
        'module_pos_discount': fields.selection([
            (0, "Allow discounts on order lines only"),
            (1, "Allow global discounts")
            ], "Discount",
            help='Allows the cashier to quickly give a percentage sale discount for all the sales order to a customer'),
        'module_pos_mercury': fields.selection([
            (0, "No credit card"),
            (1, "Allows customers to pay with credit cards.")
            ], "Credit Cards",
            help='The transactions are processed by MercuryPay'),
        'module_pos_reprint': fields.selection([
            (0, "No reprint"),
            (1, "Allow cashier to reprint receipts")
            ], "Reprints"),
    }
Exemple #6
0
class MassMailingConfiguration(osv.TransientModel):
    _name = 'mass.mailing.config.settings'
    _inherit = 'res.config.settings'

    _columns = {
        'group_mass_mailing_campaign':
        fields.selection(
            [(0, "Do not organize and schedule mail campaigns (easy)"),
             (1, "Allow using marketing campaigns (advanced)")],
            "Campaigns",
            implied_group='mass_mailing.group_mass_mailing_campaign',
            help="""Manage mass mailign using Campaigns"""),
        'group_website_popup_on_exit':
        fields.
        selection([
            (0,
             'Do not add extra content on website pages to encourage visitors to sign up'
             ),
            (1,
             'Allow the use of a pop-up snippet on website to encourage visitors to sign up on a mass mailing list'
             )
        ],
                  string="Website Pop-up",
                  implied_group="mass_mailing.group_website_popup_on_exit"),
        'module_mass_mailing_themes':
        fields.boolean("Mass mailing themes"),
    }
Exemple #7
0
class resource_resource(osv.osv):
    _name = "resource.resource"
    _description = "Resource Detail"
    _columns = {
        'name': fields.char("Name", required=True),
        'code': fields.char('Code', size=16, copy=False),
        'active' : fields.boolean('Active', track_visibility='onchange',
            help="If the active field is set to False, it will allow you to hide the resource record without removing it."),
        'company_id' : fields.many2one('res.company', 'Company'),
        'resource_type': fields.selection([('user','Human'),('material','Material')], 'Resource Type', required=True),
        'user_id' : fields.many2one('res.users', 'User', help='Related user name for the resource to manage its access.'),
        'time_efficiency' : fields.float('Efficiency Factor', size=8, required=True, help="This field depict the efficiency of the resource to complete tasks. e.g  resource put alone on a phase of 5 days with 5 tasks assigned to him, will show a load of 100% for this phase by default, but if we put a efficiency of 200%, then his load will only be 50%."),
        'calendar_id' : fields.many2one("resource.calendar", "Working Time", help="Define the schedule of resource"),
    }

    _defaults = {
        'resource_type' : 'user',
        'time_efficiency' : 1,
        'active' : True,
        'company_id': lambda self, cr, uid, context: self.pool.get('res.company')._company_default_get(cr, uid, 'resource.resource', context=context)
    }

    def copy(self, cr, uid, id, default=None, context=None):
        if default is None:
            default = {}
        if not default.get('name', False):
            default.update(name=_('%s (copy)') % (self.browse(cr, uid, id, context=context).name))
        return super(resource_resource, self).copy(cr, uid, id, default, context)
Exemple #8
0
class account_tax(osv.osv):
    """ Add fields used to define some brazilian taxes """
    _inherit = 'account.tax'

    _columns = {
        'tax_discount':
        fields.boolean('Discount this Tax in Prince',
                       help="Mark it for (ICMS, PIS e etc.)."),
        'base_reduction':
        fields.float('Redution',
                     required=True,
                     digits=0,
                     help="Um percentual decimal em % entre 0-1."),
        'amount_mva':
        fields.float('MVA Percent',
                     required=True,
                     digits=0,
                     help="Um percentual decimal em % entre 0-1."),
        'amount_type':
        fields.selection([('group', 'Group of Taxes'), ('fixed', 'Fixed'),
                          ('percent', 'Percentage of Price'),
                          ('division', 'Percentage of Price Tax Included')],
                         string="Tax Computation",
                         required=True)
    }
    _defaults = TAX_DEFAULTS
Exemple #9
0
class res_partner_tags(osv.Model):
    _description = 'Partner Tags - These tags can be used on website to find customers by sector, or ... '
    _name = 'res.partner.tag'
    _inherit = 'website.published.mixin'

    def get_selection_class(self, cr, uid, context=None):
        classname = ['default', 'primary', 'success', 'warning', 'danger']
        return [(x, str.title(x)) for x in classname]

    _columns = {
        'name':
        fields.char('Category Name', required=True, translate=True),
        'partner_ids':
        fields.many2many('res.partner',
                         'res_partner_res_partner_tag_rel',
                         id1='tag_id',
                         id2='partner_id',
                         string='Partners'),
        'classname':
        fields.selection(get_selection_class,
                         'Class',
                         help="Bootstrap class to customize the color",
                         required=True),
        'active':
        fields.boolean('Active'),
    }
    _defaults = {
        'active': True,
        'website_published': True,
        'classname': 'default',
    }
class PaymentMethod(osv.Model):
    _name = 'payment.method'
    _order = 'partner_id'

    _columns = {
        'name': fields.char('Name', help='Name of the payment method'),
        'partner_id': fields.many2one('res.partner', 'Partner', required=True),
        'acquirer_id': fields.many2one('payment.acquirer', 'Acquirer Account', required=True),
        'acquirer_ref': fields.char('Acquirer Ref.', required=True),
        'active': fields.boolean('Active'),
        'payment_ids': fields.one2many('payment.transaction', 'payment_method_id', 'Payment Transactions'),
    }

    _defaults = {
        'active': True
    }

    def create(self, cr, uid, values, context=None):
        # call custom create method if defined (i.e. ogone_create for ogone)
        if values.get('acquirer_id'):
            acquirer = self.pool['payment.acquirer'].browse(cr, uid, values.get('acquirer_id'), context=context)

            # custom create
            custom_method_name = '%s_create' % acquirer.provider
            if hasattr(self, custom_method_name):
                values.update(getattr(self, custom_method_name)(cr, uid, values, context=context))

        return super(PaymentMethod, self).create(cr, uid, values, context=context)
class account_journal(osv.osv):
    _inherit = 'account.journal'
    _columns = {
        'journal_user': fields.boolean('Active in Point of Sale', help="Check this box if this journal define a payment method that can be used in a point of sale."),

        'amount_authorized_diff' : fields.float('Amount Authorized Difference', help="This field depicts the maximum difference allowed between the ending balance and the theoretical cash when closing a session, for non-POS managers. If this maximum is reached, the user will have an error message at the closing of his session saying that he needs to contact his manager."),
    }
Exemple #12
0
class account_analytic_account(osv.Model):
    _inherit = 'account.analytic.account'
    _description = 'Analytic Account'

    _columns = {
        'use_issues':
        fields.boolean(
            'Issues',
            help=
            "Check this box to manage customer activities through this project"
        ),
    }

    def on_change_template(self,
                           cr,
                           uid,
                           ids,
                           template_id,
                           date_start=False,
                           context=None):
        res = super(account_analytic_account,
                    self).on_change_template(cr,
                                             uid,
                                             ids,
                                             template_id,
                                             date_start=date_start,
                                             context=context)
        if template_id and 'value' in res:
            template = self.browse(cr, uid, template_id, context=context)
            res['value']['use_issues'] = template.use_issues
        return res

    def _trigger_project_creation(self, cr, uid, vals, context=None):
        if context is None:
            context = {}
        res = super(account_analytic_account,
                    self)._trigger_project_creation(cr,
                                                    uid,
                                                    vals,
                                                    context=context)
        return res or (vals.get('use_issues')
                       and not 'project_creation_in_progress' in context)

    def unlink(self, cr, uid, ids, context=None):
        proj_ids = self.pool['project.project'].search(
            cr, uid, [('analytic_account_id', 'in', ids)])
        has_issues = self.pool['project.issue'].search(
            cr,
            uid, [('project_id', 'in', proj_ids)],
            count=True,
            context=context)
        if has_issues:
            raise UserError(
                _('Please remove existing issues in the project linked to the accounts you want to delete.'
                  ))
        return super(account_analytic_account, self).unlink(cr,
                                                            uid,
                                                            ids,
                                                            context=context)
Exemple #13
0
class AccountPaymentConfig(osv.TransientModel):
    _inherit = 'account.config.settings'

    _columns = {
        'module_wx_pay_webstore': fields.boolean(
            'Weixin Website Payment',
            help='-It installs the module wx_pay_webstore.'),
     }
Exemple #14
0
class hr_payroll_configuration(osv.osv_memory):
    _name = 'hr.payroll.config.settings'
    _inherit = 'res.config.settings'
    _columns = {
        'module_hr_payroll_account':
        fields.boolean('Link your payroll to accounting system',
                       help="""Create journal entries from payslips"""),
    }
Exemple #15
0
class SaleLayoutCategory(osv.Model):
    _name = 'sale_layout.category'
    _order = 'sequence, id'
    _columns = {
        'name': fields.char('Name', required=True, translate=True),
        'sequence': fields.integer('Sequence', required=True),
        'subtotal': fields.boolean('Add subtotal'),
        'separator': fields.boolean('Add separator'),
        'pagebreak': fields.boolean('Add pagebreak')
    }

    _defaults = {
        'subtotal': True,
        'separator': True,
        'pagebreak': False,
        'sequence': 10
    }
Exemple #16
0
class product_template(osv.osv):
    _inherit = "product.template"
    _columns = {
        'hr_expense_ok':
        fields.boolean(
            'Can be Expensed',
            help="Specify if the product can be selected in an HR expense line."
        ),
    }
Exemple #17
0
class res_country(osv.osv):
    _name = 'res.country'
    _inherit = 'res.country'
    _columns = {
        'intrastat': fields.boolean('Intrastat member'),
    }
    _defaults = {
        'intrastat': lambda *a: False,
    }
Exemple #18
0
class account_config_settings(osv.osv_memory):
    _inherit = 'account.config.settings'
    _columns = {
        'group_analytic_account_for_sales':
        fields.boolean(
            'Analytic accounting for sales',
            implied_group='sale.group_analytic_accounting',
            help="Allows you to specify an analytic account on sales orders."),
    }
Exemple #19
0
class crm_team(osv.Model):
    _name = "crm.team"
    _inherit = ['mail.thread', 'ir.needaction_mixin']
    _description = "Sales Team"
    _order = "name"
    _period_number = 5

    def _get_default_team_id(self, cr, uid, context=None, user_id=None):
        if context is None:
            context = {}
        if user_id is None:
            user_id = uid
        team_id = context.get('default_team_id')
        if not team_id:
            team_ids = self.search(cr,
                                   uid, [
                                       '|', ('user_id', '=', user_id),
                                       ('member_ids', 'in', user_id)
                                   ],
                                   limit=1,
                                   context=context)
            team_id = team_ids[0] if team_ids else False
        if not team_id:
            team_id = self.pool['ir.model.data'].xmlid_to_res_id(
                cr, uid, 'sales_team.team_sales_department')
        return team_id

    _columns = {
        'name': fields.char('Sales Team', size=64, required=True, translate=True),
        'code': fields.char('Code', size=8),
        'active': fields.boolean('Active', help="If the active field is set to "\
                        "false, it will allow you to hide the sales team without removing it."),
        'company_id': fields.many2one('res.company', 'Company'),
        'user_id': fields.many2one('res.users', 'Team Leader'),
        'member_ids': fields.one2many('res.users', 'sale_team_id', 'Team Members'),
        'reply_to': fields.char('Reply-To', size=64, help="The email address put in the 'Reply-To' of all emails sent by YuanCloud about cases in this sales team"),
        'working_hours': fields.float('Working Hours', digits=(16, 2)),
        'color': fields.integer('Color Index'),
    }

    _defaults = {
        'active':
        1,
        'company_id':
        lambda self, cr, uid, context: self.pool.get('res.company').
        _company_default_get(cr, uid, 'crm.team', context=context),
    }

    _sql_constraints = [('code_uniq', 'unique (code)',
                         'The code of the sales team must be unique !')]

    def create(self, cr, uid, values, context=None):
        if context is None:
            context = {}
        context['mail_create_nosubscribe'] = True
        return super(crm_team, self).create(cr, uid, values, context=context)
Exemple #20
0
class portal(osv.osv):
    """ A portal is simply a group of users with the flag 'is_portal' set to True.
        The flag 'is_portal' makes a user group usable as a portal.
    """
    _inherit = 'res.groups'
    _columns = {
        'is_portal':
        fields.boolean('Portal',
                       help="If checked, this group is usable as a portal."),
    }
Exemple #21
0
class Product(osv.osv):
    _inherit = 'product.template'

    def fields_view_get(self,
                        cr,
                        user,
                        view_id=None,
                        view_type='form',
                        context=None,
                        toolbar=False,
                        submenu=False):
        ModelData = self.pool['ir.model.data']
        if context is None:
            context = {}

        if ('product' in context) and (context['product']
                                       == 'membership_product'):
            if view_type == 'form':
                view_id = ModelData.xmlid_to_res_id(
                    cr,
                    user,
                    'membership.membership_products_form',
                    context=context)
            else:
                view_id = ModelData.xmlid_to_res_id(
                    cr,
                    user,
                    'membership.membership_products_tree',
                    context=context)
        return super(Product, self).fields_view_get(cr,
                                                    user,
                                                    view_id=view_id,
                                                    view_type=view_type,
                                                    context=context,
                                                    toolbar=toolbar,
                                                    submenu=submenu)

    _columns = {
        'membership':
        fields.boolean(
            'Membership',
            help='Check if the product is eligible for membership.'),
        'membership_date_from':
        fields.date('Membership Start Date',
                    help='Date from which membership becomes active.'),
        'membership_date_to':
        fields.date('Membership End Date',
                    help='Date until which membership remains active.'),
    }

    _sql_constraints = [
        ('membership_date_greater',
         'check(membership_date_to >= membership_date_from)',
         'Error ! Ending Date cannot be set before Beginning Date.')
    ]
Exemple #22
0
class MassMailingList(osv.Model):
    """Model of a contact list. """
    _name = 'mail.mass_mailing.list'
    _order = 'name'
    _description = 'Mailing List'

    def _get_contact_nbr(self, cr, uid, ids, name, arg, context=None):
        result = dict.fromkeys(ids, 0)
        Contacts = self.pool.get('mail.mass_mailing.contact')
        for group in Contacts.read_group(cr,
                                         uid, [('list_id', 'in', ids),
                                               ('opt_out', '!=', True)],
                                         ['list_id'], ['list_id'],
                                         context=context):
            result[group['list_id'][0]] = group['list_id_count']
        return result

    _columns = {
        'name':
        fields.char('Mailing List', required=True),
        'active':
        fields.boolean('Active'),
        'create_date':
        fields.datetime('Creation Date'),
        'contact_nbr':
        fields.function(
            _get_contact_nbr,
            type='integer',
            string='Number of Contacts',
        ),
        'popup_content':
        fields.html("Website Popup Content",
                    translate=True,
                    required=True,
                    sanitize=False),
        'popup_redirect_url':
        fields.char("Website Popup Redirect URL"),
    }

    def _get_default_popup_content(self, cr, uid, context=None):
        return """<div class="modal-header text-center">
    <h3 class="modal-title mt8">YuanCloud Presents</h3>
</div>
<div class="o_popup_message">
    <font>7</font>
    <strong>Business Hacks</strong>
    <span> to<br/>boost your marketing</span>
</div>
<p class="o_message_paragraph">Join our Marketing newsletter and get <strong>this white paper instantly</strong></p>"""

    _defaults = {
        'active': True,
        'popup_content': _get_default_popup_content,
        'popup_redirect_url': '/',
    }
Exemple #23
0
class marketing_config_settings(osv.TransientModel):
    _name = 'marketing.config.settings'
    _inherit = 'res.config.settings'
    _columns = {
        'module_marketing_campaign':
        fields.boolean(
            'Marketing campaigns',
            help='Provides leads automation through marketing campaigns. '
            'Campaigns can in fact be defined on any resource, not just CRM leads.\n'
            '-This installs the module marketing_campaign.'),
    }
Exemple #24
0
class pos_config(osv.osv):
    _inherit = 'pos.config'
    _columns = {
        'iface_reprint':
        fields.boolean(
            'Receipt Reprinting',
            help="This allows you to reprint a previously printed receipt."),
    }
    _defaults = {
        'iface_reprint': False,
    }
Exemple #25
0
class utm_medium(osv.Model):
    # OLD crm.case.channel
    _name = "utm.medium"
    _description = "Channels"
    _order = 'name'
    _columns = {
        'name': fields.char('Channel Name', required=True),
        'active': fields.boolean('Active'),
    }
    _defaults = {
        'active': lambda *a: 1,
    }
Exemple #26
0
class make_invoice(osv.osv_memory):
    _name = 'mrp.repair.make_invoice'
    _description = 'Make Invoice'

    _columns = {
        'group': fields.boolean('Group by partner invoice address'),
    }

    def make_invoices(self, cr, uid, ids, context=None):
        """ Generates invoice(s) of selected records.
        @param self: The object pointer.
        @param cr: A database cursor
        @param uid: ID of the user currently logged in
        @param ids: List of IDs selected
        @param context: A standard dictionary
        @return: Loads the view of new invoice(s).
        """
        if context is None:
            context = {}
        inv = self.browse(cr, uid, ids[0], context=context)
        order_obj = self.pool.get('mrp.repair')
        mod_obj = self.pool.get('ir.model.data')
        newinv = order_obj.action_invoice_create(cr,
                                                 uid,
                                                 context['active_ids'],
                                                 group=inv.group,
                                                 context=context)

        # We have to trigger the workflow of the given repairs, otherwise they remain 'to be invoiced'.
        # Note that the signal 'action_invoice_create' will trigger another call to the method 'action_invoice_create',
        # but that second call will not do anything, since the repairs are already invoiced.
        order_obj.signal_workflow(cr, uid, context['active_ids'],
                                  'action_invoice_create')

        form_res = mod_obj.get_object_reference(cr, uid, 'account',
                                                'invoice_form')
        form_id = form_res and form_res[1] or False
        tree_res = mod_obj.get_object_reference(cr, uid, 'account',
                                                'invoice_tree')
        tree_id = tree_res and tree_res[1] or False

        return {
            'domain': [('id', 'in', newinv.values())],
            'name': 'Invoices',
            'view_type': 'form',
            'view_mode': 'tree,form',
            'res_model': 'account.invoice',
            'view_id': False,
            'views': [(tree_id, 'tree'), (form_id, 'form')],
            'context': "{'type':'out_invoice'}",
            'type': 'ir.actions.act_window'
        }
Exemple #27
0
class mrp_repair_fee(osv.osv, ProductChangeMixin):
    _name = 'mrp.repair.fee'
    _description = 'Repair Fees Line'

    def _amount_line(self, cr, uid, ids, field_name, arg, context=None):
        """ Calculates amount.
        @param field_name: Name of field.
        @param arg: Argument
        @return: Dictionary of values.
        """
        res = {}
        tax_obj = self.pool.get('account.tax')
        cur_obj = self.pool.get('res.currency')
        for line in self.browse(cr, uid, ids, context=context):
            if line.to_invoice:
                cur = line.repair_id.pricelist_id.currency_id
                taxes = tax_obj.compute_all(cr, uid, line.tax_id, line.price_unit, cur.id, line.product_uom_qty, line.product_id.id, line.repair_id.partner_id.id)
                res[line.id] = taxes['total_included']
            else:
                res[line.id] = 0
        return res

    _columns = {
        'repair_id': fields.many2one('mrp.repair', 'Repair Order Reference', required=True, ondelete='cascade', select=True),
        'name': fields.char('Description', select=True, required=True),
        'product_id': fields.many2one('product.product', 'Product'),
        'product_uom_qty': fields.float('Quantity', digits_compute=dp.get_precision('Product Unit of Measure'), required=True),
        'price_unit': fields.float('Unit Price', required=True),
        'product_uom': fields.many2one('product.uom', 'Product Unit of Measure', required=True),
        'price_subtotal': fields.function(_amount_line, string='Subtotal', digits=0),
        'tax_id': fields.many2many('account.tax', 'repair_fee_line_tax', 'repair_fee_line_id', 'tax_id', 'Taxes'),
        'invoice_line_id': fields.many2one('account.invoice.line', 'Invoice Line', readonly=True, copy=False),
        'to_invoice': fields.boolean('To Invoice'),
        'invoiced': fields.boolean('Invoiced', readonly=True, copy=False),
    }

    _defaults = {
        'to_invoice': lambda *a: True,
    }
Exemple #28
0
class base_config_settings(osv.TransientModel):
    _inherit = 'base.config.settings'

    _columns = {
        'company_share_product': fields.boolean('Share product to all companies',
            help="Share your product to all companies defined in your instance.\n"
                 " * Checked : Product are visible for every company, even if a company is defined on the partner.\n"
                 " * Unchecked : Each company can see only its product (product where company is defined). Product not related to a company are visible for all companies."),
        'group_product_variant': fields.boolean('Manage Product Variants', 
            help='Work with product variant allows you to define some variant of the same products, an ease the product management in the ecommerce for example',
            implied_group='product.group_product_variant'),
    }

    def get_default_company_share_product(self, cr, uid, fields, context=None):
        product_rule = self.pool['ir.model.data'].xmlid_to_object(cr, uid, 'product.product_comp_rule', context=context)
        return {
            'company_share_product': not bool(product_rule.active)
        }

    def set_auth_company_share_product(self, cr, uid, ids, context=None):
        product_rule = self.pool['ir.model.data'].xmlid_to_object(cr, uid, 'product.product_comp_rule', context=context)
        for wizard in self.browse(cr, uid, ids, context=context):
            self.pool['ir.rule'].write(cr, uid, [product_rule.id], {'active': not bool(wizard.company_share_product)}, context=context)
Exemple #29
0
class base_config_settings(osv.TransientModel):
    _inherit = 'base.config.settings'

    _columns = {
        'website_wxpayment_enabled': fields.boolean('启用网站微信支付功能...'),
        'wx_officicalaccount':fields.many2one('wx.officialaccount',string="微信服务号",domain=[('is_qyhapp','=',False)]),
    }

    def default_get(self, cr, uid, fields, context=None):
        res = super(base_config_settings, self).default_get(cr, uid, fields, context=context)
        res.update(self.get_wx_pay_providers(cr, uid, fields, context=context))
        return res

    def get_wx_pay_providers(self, cr, uid, fields, context=None):
        rg = self.pool.get('payment.acquirer').search(cr, uid, [('provider','=','weixin')],context=context)
        print rg
        if rg:
            acquirerinfo=self.pool.get('payment.acquirer').browse(cr,uid,rg,context)
            platform_id = self.pool.get('wx.officialaccount').search(cr, uid,
                                                                       [('id','=',acquirerinfo[0]['weixin_officialaccount'].id)],
                                                                       context=context)
            print platform_id
            if platform_id:
                return {
                    'website_wxpayment_enabled': acquirerinfo[0]['website_published'],
                    'wx_officicalaccount': platform_id[0],
                }
            else:
                return {
                    'website_wxpayment_enabled': acquirerinfo[0]['website_published'],
                    'wx_officicalaccount':False,
                }
        else:
            return {
                'website_wxpayment_enabled': False,
                'wx_officicalaccount':False,
            }

    def set_oauth_providers(self, cr, uid, ids, context=None):
        config = self.browse(cr, uid, ids[0], context=context)
        print config
        rg = self.pool.get('payment.acquirer').search(cr, uid, [('provider','=','weixin')],context=context)
        data = {
            'website_published': config.website_wxpayment_enabled,
            'weixin_officialaccount': config.wx_officicalaccount.id,
        }
        print rg
        print data
        if rg:
            self.pool.get('payment.acquirer').write(cr, uid, rg, data)
Exemple #30
0
class AccountPaymentConfig(osv.TransientModel):
    _inherit = 'account.config.settings'

    _columns = {
        'module_payment_transfer':
        fields.boolean('Wire Transfer',
                       help='-It installs the module payment_transfer.'),
        'module_payment_paypal':
        fields.boolean('Paypal',
                       help='-It installs the module payment_paypal.'),
        'module_payment_ogone':
        fields.boolean('Ogone', help='-It installs the module payment_ogone.'),
        'module_payment_adyen':
        fields.boolean('Adyen', help='-It installs the module payment_adyen.'),
        'module_payment_buckaroo':
        fields.boolean('Buckaroo',
                       help='-It installs the module payment_buckaroo.'),
        'module_payment_authorize':
        fields.dummy('Authorize.Net',
                     help='-It installs the module payment_authorize.'),
    }

    _defaults = {'module_payment_transfer': True}