diff --git a/addons/account/i18n/account.pot b/addons/account/i18n/account.pot index 3d8be6134ce..6a2d2722232 100644 --- a/addons/account/i18n/account.pot +++ b/addons/account/i18n/account.pot @@ -9688,6 +9688,12 @@ msgstr "" msgid "You have" msgstr "" +#. module: account +#: code:addons/account/models/account_payment.py:360 +#, python-format +msgid "You have to define a sequence for %s in your company." +msgstr "" + #. module: account #: code:addons/account/wizard/account_report_general_ledger.py:21 #, python-format diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index 77a0dc50c3a..1e76dbc4b63 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -122,7 +122,7 @@ class AccountInvoice(models.Model): def _get_outstanding_info_JSON(self): self.outstanding_credits_debits_widget = json.dumps(False) if self.state == 'open': - domain = [('account_id', '=', self.account_id.id), ('partner_id', '=', self.env['res.partner']._find_accounting_partner(self.partner_id).id), ('reconciled', '=', False), ('amount_residual', '!=', 0.0)] + domain = [('account_id', '=', self.account_id.id), ('partner_id', '=', self.env['res.partner']._find_accounting_partner(self.partner_id).id), ('reconciled', '=', False), '|', ('amount_residual', '!=', 0.0), ('amount_residual_currency', '!=', 0.0)] if self.type in ('out_invoice', 'in_refund'): domain.extend([('credit', '>', 0), ('debit', '=', 0)]) type_payment = _('Outstanding credits') diff --git a/addons/account/models/account_payment.py b/addons/account/models/account_payment.py index 4bae1793ddd..e3b923aca12 100644 --- a/addons/account/models/account_payment.py +++ b/addons/account/models/account_payment.py @@ -473,6 +473,8 @@ class account_payment(models.Model): if rec.payment_type == 'outbound': sequence_code = 'account.payment.supplier.invoice' rec.name = self.env['ir.sequence'].with_context(ir_sequence_date=rec.payment_date).next_by_code(sequence_code) + if not rec.name and self.payment_type != 'transfer': + raise UserError(_("You have to define a sequence for %s in your company.") % (sequence_code,)) # Create the journal entry amount = rec.amount * (rec.payment_type in ('outbound', 'transfer') and 1 or -1) diff --git a/addons/account/report/account_invoice_report.py b/addons/account/report/account_invoice_report.py index 1bcfab43b06..4753ce92a86 100644 --- a/addons/account/report/account_invoice_report.py +++ b/addons/account/report/account_invoice_report.py @@ -110,7 +110,7 @@ class AccountInvoiceReport(models.Model): ai.type, ai.state, pt.categ_id, ai.date_due, ai.account_id, ail.account_id AS account_line_id, ai.partner_bank_id, SUM ((invoice_type.sign * ail.quantity) / u.factor * u2.factor) AS product_qty, - SUM(ail.price_subtotal_signed) AS price_total, + SUM(ail.price_subtotal_signed * invoice_type.sign) AS price_total, SUM(ABS(ail.price_subtotal_signed)) / CASE WHEN SUM(ail.quantity / u.factor * u2.factor) <> 0::numeric THEN SUM(ail.quantity / u.factor * u2.factor) diff --git a/addons/base_vat/models/res_partner.py b/addons/base_vat/models/res_partner.py index b2525706da5..dc547b2c422 100644 --- a/addons/base_vat/models/res_partner.py +++ b/addons/base_vat/models/res_partner.py @@ -200,11 +200,11 @@ class ResPartner(models.Model): # Mexican VAT verification, contributed by Vauxoo # and Panos Christeas - __check_vat_mx_re = re.compile(r"(?P[A-Za-z\xd1\xf1&]{3,4})" \ - r"[ \-_]?" \ - r"(?P[0-9]{2})(?P[01][0-9])(?P[0-3][0-9])" \ - r"[ \-_]?" \ - r"(?P[A-Za-z0-9&\xd1\xf1]{3})$") + __check_vat_mx_re = re.compile(br"(?P[A-Za-z\xd1\xf1&]{3,4})" \ + br"[ \-_]?" \ + br"(?P[0-9]{2})(?P[01][0-9])(?P[0-3][0-9])" \ + br"[ \-_]?" \ + br"(?P[A-Za-z0-9&\xd1\xf1]{3})$") def check_vat_mx(self, vat): ''' Mexican VAT verification diff --git a/addons/l10n_mx/models/chart_template.py b/addons/l10n_mx/models/chart_template.py index 4e1397073ba..d6607a7a359 100644 --- a/addons/l10n_mx/models/chart_template.py +++ b/addons/l10n_mx/models/chart_template.py @@ -16,6 +16,7 @@ class AccountChartTemplate(models.Model): if not self == self.env.ref('l10n_mx.mx_coa'): return res journal_basis = self.env['account.journal'].search([ + ('company_id', '=', company.id), ('type', '=', 'general'), ('code', '=', 'CBMX')], limit=1) company.write({'tax_cash_basis_journal_id': journal_basis.id}) diff --git a/addons/mass_mailing/models/mass_mailing_stats.py b/addons/mass_mailing/models/mass_mailing_stats.py index 2b22ae1d508..91648f22d35 100644 --- a/addons/mass_mailing/models/mass_mailing_stats.py +++ b/addons/mass_mailing/models/mass_mailing_stats.py @@ -20,7 +20,8 @@ class MailMailStats(models.Model): string='Mail ID (tech)', help='ID of the related mail_mail. This field is an integer field because ' 'the related mail_mail can be deleted separately from its statistics. ' - 'However the ID is needed for several action and controllers.' + 'However the ID is needed for several action and controllers.', + index=True, ) message_id = fields.Char(string='Message-ID') model = fields.Char(string='Document model') diff --git a/addons/mrp/models/mrp_workorder.py b/addons/mrp/models/mrp_workorder.py index 89a89fcaf55..9c39ab507d4 100644 --- a/addons/mrp/models/mrp_workorder.py +++ b/addons/mrp/models/mrp_workorder.py @@ -127,6 +127,10 @@ class MrpWorkorder(models.Model): 'Capacity', default=1.0, help="Number of pieces that can be produced in parallel.") + @api.multi + def name_get(self): + return [(wo.id, "%s - %s - %s" % (wo.production_id.name, wo.product_id.name, wo.name)) for wo in self] + @api.one @api.depends('production_id.product_qty', 'qty_produced') def _compute_is_produced(self): diff --git a/addons/mrp/views/mrp_workorder_views.xml b/addons/mrp/views/mrp_workorder_views.xml index dc4f003ffb6..b0ee656152d 100644 --- a/addons/mrp/views/mrp_workorder_views.xml +++ b/addons/mrp/views/mrp_workorder_views.xml @@ -363,6 +363,7 @@ gantt,tree,form,calendar,pivot,graph + {'search_default_work_center': True}

Work Orders are operations to be processed at a Work Center to realize a @@ -379,7 +380,9 @@ form [('production_state','not in',('done','cancel'))] gantt,tree,form,calendar,pivot,graph + + {'search_default_production': True}

Click to start a new work order. diff --git a/addons/purchase/models/stock.py b/addons/purchase/models/stock.py index 1f02f4cc8d2..64aa739daaa 100644 --- a/addons/purchase/models/stock.py +++ b/addons/purchase/models/stock.py @@ -16,10 +16,10 @@ class StockPicking(models.Model): res = super(StockPicking, self)._create_backorder(backorder_moves) for picking in self: if picking.picking_type_id.code == 'incoming': - backorder = self.search([('backorder_id', '=', picking.id)]) - backorder.message_post_with_view('mail.message_origin_link', - values={'self': backorder, 'origin': backorder.purchase_id}, - subtype_id=self.env.ref('mail.mt_note').id) + for backorder in self.search([('backorder_id', '=', picking.id)]): + backorder.message_post_with_view('mail.message_origin_link', + values={'self': backorder, 'origin': backorder.purchase_id}, + subtype_id=self.env.ref('mail.mt_note').id) return res diff --git a/addons/stock/models/stock_move.py b/addons/stock/models/stock_move.py index 874a819acae..a6b1af3664b 100644 --- a/addons/stock/models/stock_move.py +++ b/addons/stock/models/stock_move.py @@ -864,7 +864,6 @@ class StockMove(models.Model): # If you were already putting stock.move.lots on the next one in the work order, transfer those to the new move move.move_line_ids.filtered(lambda x: x.qty_done == 0.0).write({'move_id': new_move}) - self.browse(new_move).quantity_done = 0.0 move.move_line_ids._action_done() picking = self and self[0].picking_id or False moves_todo.write({'state': 'done', 'date': fields.Datetime.now()}) diff --git a/addons/stock/models/stock_picking.py b/addons/stock/models/stock_picking.py index 40cd8c8700f..afb80b4c44d 100644 --- a/addons/stock/models/stock_picking.py +++ b/addons/stock/models/stock_picking.py @@ -662,56 +662,6 @@ class Picking(models.Model): quantity_done[pack.product_id.id] += pack.qty_done return any(quantity_done[x] < quantity_todo.get(x, 0) for x in quantity_done) - def _create_extra_moves(self): - '''This function creates move lines on a picking, at the time of do_transfer, based on - unexpected product transfers (or exceeding quantities) found in the pack operations. - ''' - # TDE FIXME: move to batch - self.ensure_one() - moves = self.env['stock.move'] - for move_line in self.move_line_ids: - for product, remaining_qty in move_line._get_remaining_prod_quantities().items(): - if float_compare(remaining_qty, 0, precision_rounding=product.uom_id.rounding) > 0: - vals = self._prepare_values_extra_move(move_line, product, remaining_qty) - moves |= moves.create(vals) - if moves: - moves.with_context(skip_check=True)._action_confirm() - return moves - - @api.model - def _prepare_values_extra_move(self, op, product, remaining_qty): - """ - Creates an extra move when there is no corresponding original move to be copied - """ - Uom = self.env["product.uom"] - uom_id = product.uom_id.id - qty = remaining_qty - if op.product_id and op.product_uom_id and op.product_uom_id.id != product.uom_id.id: - if op.product_uom_id.factor > product.uom_id.factor: # If the pack operation's is a smaller unit - uom_id = op.product_uom_id.id - # HALF-UP rounding as only rounding errors will be because of propagation of error from default UoM - qty = product.uom_id._compute_quantity(remaining_qty, op.product_uom_id, rounding_method='HALF-UP') - picking = op.picking_id - ref = product.default_code - name = '[' + ref + ']' + ' ' + product.name if ref else product.name - proc_id = False - for m in op.linked_move_operation_ids: - if m.move_id.procurement_id: - proc_id = m.move_id.procurement_id.id - break - return { - 'picking_id': picking.id, - 'location_id': picking.location_id.id, - 'location_dest_id': picking.location_dest_id.id, - 'product_id': product.id, - 'product_uom': uom_id, - 'product_uom_qty': qty, - 'name': _('Extra Move: ') + name, - 'state': 'draft', - 'restrict_partner_id': op.owner_id.id, - 'group_id': picking.group_id.id, - } - def _create_backorder(self, backorder_moves=[]): """ Move all non-done lines into a new backorder picking. If the key 'do_only_split' is given in the context, then move all lines not in context.get('split', []) instead of all non-done lines. """ diff --git a/addons/stock/views/stock_move_views.xml b/addons/stock/views/stock_move_views.xml index c4c360774e6..195579065ab 100644 --- a/addons/stock/views/stock_move_views.xml +++ b/addons/stock/views/stock_move_views.xml @@ -156,25 +156,7 @@ - - - - - - - - - - - - - - - - - - - +