diff --git a/addons/account/models/account.py b/addons/account/models/account.py index 4d614fdaf0b2be1349d966bf12c4b898d05be279..b9d1565c9b6c5a0868098dc19a6978be8cc07b87 100644 --- a/addons/account/models/account.py +++ b/addons/account/models/account.py @@ -178,6 +178,13 @@ class AccountAccount(models.Model): for account in self: if (account.company_id.id <> vals['company_id']) and move_lines: raise UserError(_('You cannot change the owner company of an account that already contains journal items.')) + # If user change the reconcile flag, all aml should be recomputed for that account and this is very costly. + # So to prevent some bugs we add a constraint saying that you cannot change the reconcile field if there is any aml existing + # for that account. + if vals.get('reconcile'): + move_lines = self.env['account.move.line'].search([('account_id', 'in', self.ids)], limit=1) + if len(move_lines): + raise UserError(_('You cannot change the value of the reconciliation on this account as it already has some moves')) return super(AccountAccount, self).write(vals) @api.multi diff --git a/addons/account/report/account_aged_partner_balance.py b/addons/account/report/account_aged_partner_balance.py index fb5f90f96ec05a77c3393a3a122ed42aad5bca66..737a07e298aeb3eee78d00e445e93cf8c60108fa 100644 --- a/addons/account/report/account_aged_partner_balance.py +++ b/addons/account/report/account_aged_partner_balance.py @@ -92,11 +92,12 @@ class ReportAgedPartnerBalance(models.AbstractModel): for partial_line in line.matched_credit_ids: if partial_line.create_date[:10] <= date_from: line_amount -= partial_line.amount - undue_amounts[partner_id] += line_amount - lines[partner_id].append({ - 'line': line, - 'amount': line_amount, - 'period': 6, + if not self.env.user.company_id.currency_id.is_zero(line_amount): + undue_amounts[partner_id] += line_amount + lines[partner_id].append({ + 'line': line, + 'amount': line_amount, + 'period': 6, }) # Use one query per period and store results in history (a list variable) @@ -144,12 +145,13 @@ class ReportAgedPartnerBalance(models.AbstractModel): if partial_line.create_date[:10] <= date_from: line_amount -= partial_line.amount - partners_amount[partner_id] += line_amount - lines[partner_id].append({ - 'line': line, - 'amount': line_amount, - 'period': i + 1, - }) + if not self.env.user.company_id.currency_id.is_zero(line_amount): + partners_amount[partner_id] += line_amount + lines[partner_id].append({ + 'line': line, + 'amount': line_amount, + 'period': i + 1, + }) history.append(partners_amount) for partner in partners: diff --git a/addons/hr_expense/models/hr_expense.py b/addons/hr_expense/models/hr_expense.py index 653d55f1a9cf65632da405f6a64e6435d799cf91..f8dc372f39e1e0c3157c6d25222a37910d43afb3 100644 --- a/addons/hr_expense/models/hr_expense.py +++ b/addons/hr_expense/models/hr_expense.py @@ -339,7 +339,8 @@ class HrExpense(models.Model): 'product_id': product.id, 'product_uom_id': product.uom_id.id, 'quantity': 1, - 'unit_amount': price + 'unit_amount': price, + 'company_id': employee.company_id.id, }) return super(HrExpense, self).message_new(msg_dict, custom_values) diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js index 1282d35d3a963772d680ab7fa741e2acd67f609e..b34e9c32290af6d1da8a346cb75560121dd39020 100644 --- a/addons/point_of_sale/static/src/js/models.js +++ b/addons/point_of_sale/static/src/js/models.js @@ -1924,7 +1924,7 @@ exports.Order = Backbone.Model.extend({ }, initialize_validation_date: function () { - this.validation_date = this.validation_date || new Date(); + this.validation_date = new Date(); }, set_tip: function(tip) { diff --git a/addons/purchase_requisition/views/purchase_requisition_views.xml b/addons/purchase_requisition/views/purchase_requisition_views.xml index d5177adf9241bb31e2b229689ff30108102d6b0b..61fac151782507414b07e8591d6a7d3fcfec7ffb 100644 --- a/addons/purchase_requisition/views/purchase_requisition_views.xml +++ b/addons/purchase_requisition/views/purchase_requisition_views.xml @@ -139,7 +139,7 @@ <field name="ordering_date" attrs="{'readonly': [('state','not in',('draft','in_progress','open'))]}"/> <field name="schedule_date" attrs="{'readonly': [('state','not in',('draft','in_progress','open'))]}"/> <field name="origin" placeholder="e.g. PO0025" attrs="{'readonly': [('state', '!=', 'draft')]}"/> - <field name="picking_type_id" widget="selection" groups="stock.group_stock_adv_location" attrs="{'readonly': [('state', '!=', 'draft')]}"/> + <field name="picking_type_id" widget="selection" groups="stock.group_adv_location" attrs="{'readonly': [('state', '!=', 'draft')]}"/> <field name="company_id" groups="base.group_multi_company" options="{'no_create': True}" attrs="{'readonly': [('state','not in',('draft'))]}"/> </group> </group> diff --git a/addons/sale_margin/views/sale_margin_view.xml b/addons/sale_margin/views/sale_margin_view.xml index fa9c56fe28a199d53ea20ab647686c865b3e5e15..b0da87326faec5a322508b8de41ae93da5634173 100644 --- a/addons/sale_margin/views/sale_margin_view.xml +++ b/addons/sale_margin/views/sale_margin_view.xml @@ -20,7 +20,7 @@ <field name="inherit_id" ref="sale.view_order_form"/> <field name="arch" type="xml"> <xpath expr="//field[@name='order_line']/form//field[@name='price_unit']" position="after"> - <field name="purchase_price" groups="base.group_user" invisible="True"/> + <field name="purchase_price" groups="base.group_user"/> </xpath> </field> </record> diff --git a/doc/cla/individual/tiangolo.md b/doc/cla/individual/tiangolo.md new file mode 100644 index 0000000000000000000000000000000000000000..dfb1c19c218007de4848389bf3d7b16385d6765a --- /dev/null +++ b/doc/cla/individual/tiangolo.md @@ -0,0 +1,11 @@ +Colombia, 2016-10-04 + +I hereby agree to the terms of the Odoo Individual Contributor License +Agreement v1.0. + +I declare that I am authorized and able to make this agreement and sign this +declaration. + +Signed, + +Sebastián RamÃrez tiangolo@gmail.com https://github.com/tiangolo diff --git a/doc/howtos/backend.rst b/doc/howtos/backend.rst index 46891f181a5bc80af467b05bfe6fbadb78f52ec8..a19e9376b9e5941bdc77dc558d97ce2937559257 100644 --- a/doc/howtos/backend.rst +++ b/doc/howtos/backend.rst @@ -211,7 +211,7 @@ overridden by setting :attr:`~odoo.models.Model._rec_name`. .. only:: solutions - Edit the file ``openacademy/models.py`` to include a *Course* class. + Edit the file ``openacademy/models/models.py`` to include a *Course* class. .. patch:: @@ -255,7 +255,7 @@ be declared in the ``'data'`` list (always loaded) or in the ``'demo'`` list .. only:: solutions - Edit the file ``openacademy/demo.xml`` to include some data. + Edit the file ``openacademy/demo/demo.xml`` to include some data. .. patch:: @@ -484,7 +484,7 @@ client data; it is also related to its sale order line records. .. only:: solutions - #. Create the class *Session* in ``openacademy/models.py``. + #. Create the class *Session* in ``openacademy/models/models.py``. #. Add access to the session object in ``openacademy/view/openacademy.xml``. .. patch:: @@ -684,7 +684,7 @@ instead of a single view its ``arch`` field is composed of any number of inspect the view, find its external ID and the place to put the new field. - #. Create a file ``openacademy/partner.py`` and import it in + #. Create a file ``openacademy/models/partner.py`` and import it in ``__init__.py`` #. Create a file ``openacademy/views/partner.xml`` and add it to ``__manifest__.py`` diff --git a/odoo/addons/base/ir/ir_model.py b/odoo/addons/base/ir/ir_model.py index 79d191dce423b93bed4801cf212e9d38eddf74c0..b4376c99467bc97d992ea86454204b67f01d651f 100644 --- a/odoo/addons/base/ir/ir_model.py +++ b/odoo/addons/base/ir/ir_model.py @@ -1276,7 +1276,7 @@ class IrModelData(models.Model): self._cr.commit() - self.unlink() + datas.unlink() @api.model def _process_end(self, modules): diff --git a/odoo/models.py b/odoo/models.py index 00e69e6369f2d87fad6426e5da90707a8347e640..9270782eadbdc3ef426f3b9a51b2963ca72b9b40 100644 --- a/odoo/models.py +++ b/odoo/models.py @@ -1728,7 +1728,7 @@ class BaseModel(object): for order_part in orderby.split(','): order_split = order_part.split() order_field = order_split[0] - if order_field in groupby_fields: + if order_field == 'id' or order_field in groupby_fields: if self._fields[order_field.split(':')[0]].type == 'many2one': order_clause = self._generate_order_by(order_part, query).replace('ORDER BY ', '') diff --git a/odoo/tools/misc.py b/odoo/tools/misc.py index 533b7277119f69fe03bbffaf977e9d1cc769918c..1c4cc68283c4b23ef29a0e371cb2df514343e383 100644 --- a/odoo/tools/misc.py +++ b/odoo/tools/misc.py @@ -340,13 +340,13 @@ try: # add some sanitizations to respect the excel sheet name restrictions # as the sheet name is often translatable, can not control the input class PatchedWorkbook(xlwt.Workbook): - def add_sheet(self, name): + def add_sheet(self, name, cell_overwrite_ok=False): # invalid Excel character: []:*?/\ name = re.sub(r'[\[\]:*?/\\]', '', name) # maximum size is 31 characters name = name[:31] - return super(PatchedWorkbook, self).add_sheet(name) + return super(PatchedWorkbook, self).add_sheet(name, cell_overwrite_ok=cell_overwrite_ok) xlwt.Workbook = PatchedWorkbook