mirror of
https://gitlab.com/flectra-hq/flectra.git
synced 2025-02-25 18:55:21 -06:00
[PATCH] Upstream patch - 02082022
This commit is contained in:
@@ -334,7 +334,7 @@ class AutomaticEntryWizard(models.TransientModel):
|
||||
destination_move_offset += 2
|
||||
accrual_move_lines = accrual_move.mapped('line_ids').filtered(lambda line: line.account_id == accrual_account)[accrual_move_offsets[accrual_move]:accrual_move_offsets[accrual_move]+2]
|
||||
accrual_move_offsets[accrual_move] += 2
|
||||
(accrual_move_lines + destination_move_lines).reconcile()
|
||||
(accrual_move_lines + destination_move_lines).filtered(lambda line: not line.currency_id.is_zero(line.balance)).reconcile()
|
||||
move.message_post(body=self._format_strings(_('Adjusting Entries have been created for this invoice:<ul><li>%(link1)s cancelling '
|
||||
'{percent:.2f}%% of {amount}</li><li>%(link0)s postponing it to {new_date}</li></ul>',
|
||||
link0=self._format_move_link(destination_move),
|
||||
|
||||
@@ -31,7 +31,7 @@ class GoogleDrive(models.Model):
|
||||
_description = "Google Drive templates config"
|
||||
|
||||
def _module_deprecated(self):
|
||||
return GOOGLE_AUTH_DEPRECATION_DATE > fields.Date.today()
|
||||
return GOOGLE_AUTH_DEPRECATION_DATE < fields.Date.today()
|
||||
|
||||
def get_google_drive_url(self, res_id, template_id):
|
||||
if self._module_deprecated():
|
||||
|
||||
@@ -33,7 +33,9 @@ class SaleOrder(models.Model):
|
||||
|
||||
def _compute_l10n_de_document_title(self):
|
||||
for record in self:
|
||||
if record.state in ('draft', 'sent'):
|
||||
if self._context.get('proforma'):
|
||||
record.l10n_de_document_title = _('Pro Forma Invoice')
|
||||
elif record.state in ('draft', 'sent'):
|
||||
record.l10n_de_document_title = _('Quotation')
|
||||
else:
|
||||
record.l10n_de_document_title = _('Sales Order')
|
||||
|
||||
@@ -723,6 +723,8 @@ class AccountEdiFormat(models.Model):
|
||||
'name': name_attachment,
|
||||
'datas': attachment_64,
|
||||
'type': 'binary',
|
||||
'res_model': 'account.move',
|
||||
'res_id': new_invoice.id,
|
||||
})
|
||||
|
||||
# default_res_id is had to context to avoid facturx to import his content
|
||||
|
||||
@@ -93,7 +93,7 @@ class Pricelist(models.Model):
|
||||
def _compute_price_rule_get_items(self, products_qty_partner, date, uom_id, prod_tmpl_ids, prod_ids, categ_ids):
|
||||
self.ensure_one()
|
||||
# Load all rules
|
||||
self.env['product.pricelist.item'].flush(['price', 'currency_id', 'company_id'])
|
||||
self.env['product.pricelist.item'].flush(['price', 'currency_id', 'company_id', 'active'])
|
||||
self.env.cr.execute(
|
||||
"""
|
||||
SELECT
|
||||
@@ -108,6 +108,7 @@ class Pricelist(models.Model):
|
||||
AND (item.pricelist_id = %s)
|
||||
AND (item.date_start IS NULL OR item.date_start<=%s)
|
||||
AND (item.date_end IS NULL OR item.date_end>=%s)
|
||||
AND (item.active = TRUE)
|
||||
ORDER BY
|
||||
item.applied_on, item.min_quantity desc, categ.complete_name desc, item.id desc
|
||||
""",
|
||||
@@ -573,6 +574,9 @@ class PricelistItem(models.Model):
|
||||
self.env['product.product'].invalidate_cache(['price'])
|
||||
return res
|
||||
|
||||
def toggle_active(self):
|
||||
raise ValidationError(_("You cannot disable a pricelist rule, please delete it or archive its pricelist instead."))
|
||||
|
||||
def _compute_price(self, price, price_uom, product, quantity=1.0, partner=False):
|
||||
"""Compute the unit price of a product in the context of a pricelist application.
|
||||
The unused parameters are there to make the full context available for overrides.
|
||||
|
||||
@@ -221,6 +221,7 @@
|
||||
<template id="report_saleorder_pro_forma">
|
||||
<t t-call="web.html_container">
|
||||
<t t-set="is_pro_forma" t-value="True"/>
|
||||
<t t-set="docs" t-value="docs.with_context(proforma=True)"/>
|
||||
<t t-foreach="docs" t-as="doc">
|
||||
<t t-call="sale.report_saleorder_document" t-lang="doc.partner_id.lang"/>
|
||||
</t>
|
||||
|
||||
@@ -224,7 +224,7 @@ class Product(models.Model):
|
||||
if isinstance(item, int):
|
||||
ids.add(item)
|
||||
else:
|
||||
domain = expression.OR([[('name', 'ilike', item)], domain])
|
||||
domain = expression.OR([[(self.env[model]._rec_name, 'ilike', item)], domain])
|
||||
if domain:
|
||||
ids |= set(self.env[model].search(domain).ids)
|
||||
return ids
|
||||
|
||||
@@ -378,7 +378,7 @@ class StockWarehouseOrderpoint(models.Model):
|
||||
to_refill = {k: v for k, v in to_refill.items() if float_compare(
|
||||
v, 0.0, precision_digits=rounding) < 0.0}
|
||||
|
||||
lot_stock_id_by_warehouse = self.env['stock.warehouse'].search_read([
|
||||
lot_stock_id_by_warehouse = self.env['stock.warehouse'].with_context(active_test=False).search_read([
|
||||
('id', 'in', [g[1] for g in to_refill.keys()])
|
||||
], ['lot_stock_id'])
|
||||
lot_stock_id_by_warehouse = {w['id']: w['lot_stock_id'][0] for w in lot_stock_id_by_warehouse}
|
||||
|
||||
@@ -12,8 +12,11 @@ class SaleOrder(models.Model):
|
||||
|
||||
def _cart_update(self, product_id=None, line_id=None, add_qty=0, set_qty=0, **kwargs):
|
||||
values = super(SaleOrder, self)._cart_update(product_id, line_id, add_qty, set_qty, **kwargs)
|
||||
line_id = values.get('line_id')
|
||||
values = self._cart_lines_stock_update(values, **kwargs)
|
||||
return values
|
||||
|
||||
def _cart_lines_stock_update(self, values, **kwargs):
|
||||
line_id = values.get('line_id')
|
||||
for line in self.order_line:
|
||||
if line.product_id.type == 'product' and line.product_id.inventory_availability in ['always', 'threshold']:
|
||||
cart_qty = sum(self.order_line.filtered(lambda p: p.product_id.id == line.product_id.id).mapped('product_uom_qty'))
|
||||
|
||||
Reference in New Issue
Block a user