diff options
| -rw-r--r-- | addons/account/models/account_invoice.py | 3 | ||||
| -rw-r--r-- | addons/account/models/account_move.py | 5 | ||||
| -rw-r--r-- | addons/account/tests/test_account_supplier_invoice.py | 2 | ||||
| -rw-r--r-- | addons/account/views/account_view.xml | 4 | ||||
| -rw-r--r-- | addons/auth_ldap/models/res_company_ldap.py | 2 | ||||
| -rw-r--r-- | addons/base_vat/models/res_partner.py | 7 | ||||
| -rw-r--r-- | addons/delivery/models/delivery_carrier.py | 2 | ||||
| -rw-r--r-- | addons/l10n_be/data/account_pcmn_belgium_data.xml | 1 | ||||
| -rw-r--r-- | addons/mail/wizard/email_template_preview.py | 1 | ||||
| -rw-r--r-- | addons/mrp/wizard/change_production_qty.py | 4 | ||||
| -rw-r--r-- | addons/point_of_sale/static/src/js/models.js | 3 | ||||
| -rw-r--r-- | addons/project/controllers/portal.py | 2 | ||||
| -rw-r--r-- | addons/project/views/project_views.xml | 1 | ||||
| -rw-r--r-- | addons/sale_stock/security/sale_stock_security.xml | 8 | ||||
| -rw-r--r-- | addons/stock/security/stock_security.xml | 8 | ||||
| -rw-r--r-- | addons/website_membership/controllers/main.py | 2 | ||||
| -rw-r--r-- | odoo/fields.py | 2 |
17 files changed, 40 insertions, 17 deletions
diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index 35ae3065467..96fc0b37fb1 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -451,6 +451,9 @@ class AccountInvoice(models.Model): @api.model def create(self, vals): + if not vals.get('journal_id') and vals.get('type'): + vals['journal_id'] = self.with_context(type=vals.get('type'))._default_journal().id + onchanges = { '_onchange_partner_id': ['account_id', 'payment_term_id', 'fiscal_position_id', 'partner_bank_id'], '_onchange_journal_id': ['currency_id'], diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index dc38e526693..a90f1c8421d 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -1361,6 +1361,9 @@ class AccountPartialReconcile(models.Model): ''' return tax.cash_basis_base_account_id or line.account_id + def _get_amount_tax_cash_basis(self, amount, line): + return line.company_id.currency_id.round(amount) + def create_tax_cash_basis_entry(self, percentage_before_rec): self.ensure_one() move_date = self.debit_move_id.date @@ -1377,7 +1380,7 @@ class AccountPartialReconcile(models.Model): percentage_after = line._get_matched_percentage()[move.id] #amount is the current cash_basis amount minus the one before the reconciliation amount = line.balance * percentage_after - line.balance * percentage_before - rounded_amt = line.company_id.currency_id.round(amount) + rounded_amt = self._get_amount_tax_cash_basis(amount, line) if float_is_zero(rounded_amt, precision_rounding=line.company_id.currency_id.rounding): continue if line.tax_line_id and line.tax_line_id.tax_exigibility == 'on_payment': diff --git a/addons/account/tests/test_account_supplier_invoice.py b/addons/account/tests/test_account_supplier_invoice.py index d6584ab6138..d1a6ef46902 100644 --- a/addons/account/tests/test_account_supplier_invoice.py +++ b/addons/account/tests/test_account_supplier_invoice.py @@ -24,6 +24,7 @@ class TestAccountSupplierInvoice(AccountingTestCase): 'account_id': invoice_account, 'type': 'in_invoice', }) + self.assertEquals(invoice.journal_id.type, 'purchase') self.env['account.invoice.line'].create({'product_id': self.env.ref('product.product_product_4').id, 'quantity': 1.0, @@ -79,6 +80,7 @@ class TestAccountSupplierInvoice(AccountingTestCase): 'account_id': invoice_account, 'type': 'in_invoice', }) + self.assertEquals(invoice.journal_id.type, 'purchase') invoice_line = self.env['account.invoice.line'].create({'product_id': self.env.ref('product.product_product_4').id, 'quantity': 5.0, diff --git a/addons/account/views/account_view.xml b/addons/account/views/account_view.xml index 44b6835f0aa..03ebd6038b8 100644 --- a/addons/account/views/account_view.xml +++ b/addons/account/views/account_view.xml @@ -866,7 +866,7 @@ <field name="amount" class="oe_inline"/> <label string="%" class="oe_inline" attrs="{'invisible':[('amount_type','!=','percentage')]}" /> </div> - <field name="journal_id" domain="[('company_id', '=', company_id)]" widget="selection"/> + <field name="journal_id" domain="[('type', '!=', 'general'), ('company_id', '=', company_id)]" widget="selection"/> </group> </group> <div class="oe_edit_only"> @@ -888,7 +888,7 @@ <field name="second_amount" class="oe_inline"/> <label string="%" class="oe_inline" attrs="{'invisible':[('amount_type','!=','percentage')]}" /> </div> - <field name="second_journal_id" string="Journal" domain="[('company_id', '=', company_id)]" widget="selection"/> + <field name="second_journal_id" string="Journal" domain="[('type', '!=', 'general'), ('company_id', '=', company_id)]" widget="selection"/> </group> </group> </sheet> diff --git a/addons/auth_ldap/models/res_company_ldap.py b/addons/auth_ldap/models/res_company_ldap.py index 92914a93c4d..cafb90c131a 100644 --- a/addons/auth_ldap/models/res_company_ldap.py +++ b/addons/auth_ldap/models/res_company_ldap.py @@ -194,7 +194,7 @@ class CompanyLDAP(models.Model): elif conf['create_user']: _logger.debug("Creating new Odoo user \"%s\" from LDAP" % login) values = self.map_ldap_attributes(conf, login, ldap_entry) - SudoUser = self.env['res.users'].sudo() + SudoUser = self.env['res.users'].sudo().with_context(no_reset_password=True) if conf['user']: values['active'] = True user_id = SudoUser.browse(conf['user'][0]).copy(default=values).id diff --git a/addons/base_vat/models/res_partner.py b/addons/base_vat/models/res_partner.py index 778cf9c31d6..432f7f04c42 100644 --- a/addons/base_vat/models/res_partner.py +++ b/addons/base_vat/models/res_partner.py @@ -356,3 +356,10 @@ class ResPartner(models.Model): return int(vat[9]) == c1 and int(vat[10]) == c2 return False + + def check_vat_al(self, vat): + try: + import stdnum.al + return stdnum.al.vat.is_valid(vat) + except ImportError: + return True diff --git a/addons/delivery/models/delivery_carrier.py b/addons/delivery/models/delivery_carrier.py index 3a7424c165c..850c90d010b 100644 --- a/addons/delivery/models/delivery_carrier.py +++ b/addons/delivery/models/delivery_carrier.py @@ -120,7 +120,7 @@ class DeliveryCarrier(models.Model): if hasattr(self, '%s_rate_shipment' % self.delivery_type): res = getattr(self, '%s_rate_shipment' % self.delivery_type)(order) # apply margin on computed price - res['price'] = res['price'] * (1.0 + (float(self.margin) / 100.0)) + res['price'] = float(res['price']) * (1.0 + (float(self.margin) / 100.0)) # free when order is large enough if res['success'] and self.free_over and order._compute_amount_total_without_delivery() >= self.amount: res['warning_message'] = _('Info:\nThe shipping is free because the order amount exceeds %.2f.\n(The actual shipping cost is: %.2f)') % (self.amount, res['price']) diff --git a/addons/l10n_be/data/account_pcmn_belgium_data.xml b/addons/l10n_be/data/account_pcmn_belgium_data.xml index 1f62bb1d5a7..59cf531f385 100644 --- a/addons/l10n_be/data/account_pcmn_belgium_data.xml +++ b/addons/l10n_be/data/account_pcmn_belgium_data.xml @@ -558,6 +558,7 @@ <record id="a4512" model="account.account.template"> <field name="name">Compte courant administration T.V.A.</field> <field name="code">4512</field> + <field name="reconcile" eval="True"/> <field name="user_type_id" ref="account.data_account_type_current_liabilities"/> <field name="chart_template_id" ref="l10nbe_chart_template"/> </record> diff --git a/addons/mail/wizard/email_template_preview.py b/addons/mail/wizard/email_template_preview.py index 89808b0b6d1..eb02b082b4e 100644 --- a/addons/mail/wizard/email_template_preview.py +++ b/addons/mail/wizard/email_template_preview.py @@ -34,6 +34,7 @@ class TemplatePreview(models.TransientModel): res_id = fields.Selection(_get_records, 'Sample Document') partner_ids = fields.Many2many('res.partner', string='Recipients') + attachment_ids = fields.Many2many(string='Attachments', store=False) @api.onchange('res_id') @api.multi diff --git a/addons/mrp/wizard/change_production_qty.py b/addons/mrp/wizard/change_production_qty.py index 9ee65f0df1d..3ac03e41798 100644 --- a/addons/mrp/wizard/change_production_qty.py +++ b/addons/mrp/wizard/change_production_qty.py @@ -50,6 +50,7 @@ class ChangeProductionQty(models.TransientModel): qty_produced = production.product_id.uom_id._compute_quantity(sum(done_moves.mapped('product_qty')), production.product_uom_id) factor = production.product_uom_id._compute_quantity(production.product_qty - qty_produced, production.bom_id.product_uom_id) / production.bom_id.product_qty boms, lines = production.bom_id.explode(production.product_id, factor, picking_type=production.bom_id.picking_type_id) + done_quantities = {move: move.quantity_done for move in production.move_raw_ids} for line, line_data in lines: production._update_raw_move(line, line_data) operation_bom_qty = {} @@ -59,6 +60,9 @@ class ChangeProductionQty(models.TransientModel): self._update_product_to_produce(production, production.product_qty - qty_produced) moves = production.move_raw_ids.filtered(lambda x: x.state not in ('done', 'cancel')) moves._action_assign() + for move in production.move_raw_ids: + if move.quantity_done != done_quantities[move]: + move._set_quantity_done(done_quantities[move]) for wo in production.workorder_ids: operation = wo.operation_id if operation_bom_qty.get(operation.id): diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js index 46f05bd6001..9ad975f4bbd 100644 --- a/addons/point_of_sale/static/src/js/models.js +++ b/addons/point_of_sale/static/src/js/models.js @@ -1526,7 +1526,8 @@ exports.Orderline = Backbone.Model.extend({ return false; }else if(this.get_discount() > 0){ // we don't merge discounted orderlines return false; - }else if(price !== orderline.get_product().get_price(orderline.order.pricelist, this.get_quantity())){ + }else if(!utils.float_is_zero(price - orderline.get_product().get_price(orderline.order.pricelist, this.get_quantity()), + this.pos.currency.decimals)){ return false; }else if(this.product.tracking == 'lot') { return false; diff --git a/addons/project/controllers/portal.py b/addons/project/controllers/portal.py index 1ea74c36da4..4cc54906447 100644 --- a/addons/project/controllers/portal.py +++ b/addons/project/controllers/portal.py @@ -160,7 +160,7 @@ class CustomerPortal(CustomerPortal): # content according to pager and archive selected if groupby == 'project': order = "project_id, %s" % order # force sort on project first to group by project in view - tasks = request.env['project.task'].search(domain, order=order, limit=self._items_per_page, offset=pager['offset']) + tasks = request.env['project.task'].search(domain, order=order, limit=self._items_per_page, offset=(page - 1) * self._items_per_page) request.session['my_tasks_history'] = tasks.ids[:100] if groupby == 'project': grouped_tasks = [request.env['project.task'].concat(*g) for k, g in groupbyelem(tasks, itemgetter('project_id'))] diff --git a/addons/project/views/project_views.xml b/addons/project/views/project_views.xml index 0f168cd52f5..be13932261a 100644 --- a/addons/project/views/project_views.xml +++ b/addons/project/views/project_views.xml @@ -516,7 +516,6 @@ <field name="stage_id" options='{"group_by_tooltip": {"description": "Stage Description", "legend_priority": "Use of stars"}}'/> <field name="user_id"/> <field name="user_email"/> - <field name="description"/> <field name="sequence"/> <field name="date_deadline"/> <field name="message_needaction_counter"/> diff --git a/addons/sale_stock/security/sale_stock_security.xml b/addons/sale_stock/security/sale_stock_security.xml index 630a6512b2d..c53b98a341d 100644 --- a/addons/sale_stock/security/sale_stock_security.xml +++ b/addons/sale_stock/security/sale_stock_security.xml @@ -10,5 +10,13 @@ <field name="name">Display incoterms on Sales Order and related invoices</field> <field name="category_id" ref="base.module_category_hidden"/> </record> + + <!-- Stock Portal Access Rules --> + <record id="stock_picking_rule_portal" model="ir.rule"> + <field name="name">Portal Follower Pickings</field> + <field name="model_id" ref="stock.model_stock_picking"/> + <field name="domain_force">['|', '|', ('message_partner_ids', 'in', [user.partner_id.id]), ('partner_id', '=', user.partner_id.id), ('sale_id.partner_id', '=', user.partner_id.id)]</field> + <field name="groups" eval="[(4, ref('base.group_portal'))]"/> + </record> </data> </odoo> diff --git a/addons/stock/security/stock_security.xml b/addons/stock/security/stock_security.xml index 3301a5fbb8c..5a61d942114 100644 --- a/addons/stock/security/stock_security.xml +++ b/addons/stock/security/stock_security.xml @@ -134,14 +134,6 @@ <field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field> </record> - <!-- Stock Portal Access Rules --> - <record id="stock_picking_rule_portal" model="ir.rule"> - <field name="name">Portal Follower Pickings</field> - <field name="model_id" ref="stock.model_stock_picking"/> - <field name="domain_force">['|', '|', ('message_partner_ids', 'in', [user.partner_id.id]), ('partner_id.id', '=', user.partner_id.id), ('sale_id.partner_id.id', '=', user.partner_id.id)]</field> - <field name="groups" eval="[(4, ref('base.group_portal'))]"/> - </record> - <record model="ir.rule" id="stock_location_route_comp_rule"> <field name="name">stock_location_route multi-company</field> <field name="model_id" ref="model_stock_location_route"/> diff --git a/addons/website_membership/controllers/main.py b/addons/website_membership/controllers/main.py index 42dcf599220..c5c5567a603 100644 --- a/addons/website_membership/controllers/main.py +++ b/addons/website_membership/controllers/main.py @@ -103,7 +103,7 @@ class WebsiteMembership(http.Controller): # get google maps localization of partners google_map_partner_ids = [] - if request.env.ref('website_membership.opt_index_google_map').customize_show: + if request.env.ref('website_membership.opt_index_google_map').active: google_map_partner_ids = MembershipLine.search(line_domain).get_published_companies(limit=2000) search_domain = [('membership_state', '=', 'free'), ('website_published', '=', True)] diff --git a/odoo/fields.py b/odoo/fields.py index d8efade6691..d39fa6e35fa 100644 --- a/odoo/fields.py +++ b/odoo/fields.py @@ -2413,6 +2413,8 @@ class Many2many(_RelationalMulti): self.column2 = '%s_id' % comodel._table # check validity of table name check_pg_name(self.relation) + else: + self.relation = self.column1 = self.column2 = None def _setup_regular_full(self, model): super(Many2many, self)._setup_regular_full(model) |
