mirror of
https://gitlab.com/flectra-hq/flectra.git
synced 2026-08-17 16:54:42 -05:00
[PATCH] Upstream patch - 20122022
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo, Flectra. See LICENSE file for full copyright and licensing details.
|
||||
from . import models
|
||||
|
||||
@@ -11,7 +11,7 @@ This is the module to manage the accounting chart for Algeria in Flectra.
|
||||
This module applies to companies based in Algeria.
|
||||
""",
|
||||
'author': 'Osis',
|
||||
'depends': ['account'],
|
||||
'depends': ['account', 'l10n_multilang'],
|
||||
'data': [
|
||||
'data/account_chart_template_data.xml',
|
||||
'data/account.account.template.csv',
|
||||
@@ -19,6 +19,7 @@ This module applies to companies based in Algeria.
|
||||
'data/account_tax_data.xml',
|
||||
'data/account_fiscal_position_template_data.xml',
|
||||
'data/account_chart_template_configuration_data.xml',
|
||||
'report/account_move_report.xml',
|
||||
],
|
||||
'license': 'LGPL-3',
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
from . import account_move
|
||||
@@ -0,0 +1,12 @@
|
||||
from flectra import api, models, fields
|
||||
|
||||
|
||||
class AccountMove(models.Model):
|
||||
_inherit = 'account.move'
|
||||
|
||||
amount_total_words = fields.Char("Amount total in words", compute="_compute_amount_total_words")
|
||||
|
||||
@api.depends('amount_total', 'currency_id')
|
||||
def _compute_amount_total_words(self):
|
||||
for record in self:
|
||||
record.amount_total_words = record.currency_id.amount_to_text(record.amount_total)
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<flectra>
|
||||
<template id="invoice_report_amount_in_words_inherit" inherit_id="account.report_invoice_document">
|
||||
<xpath expr="//div[hasclass('clearfix')]" position="after">
|
||||
<div style="margin-top:30px; margin-bottom:20px;">
|
||||
<p class="font-weight-bold">
|
||||
Arranged the present invoice in the amount of : <span t-field="o.amount_total_words"/>
|
||||
</p>
|
||||
</div>
|
||||
</xpath>
|
||||
</template>
|
||||
</flectra>
|
||||
@@ -89,7 +89,7 @@ class Message(models.Model):
|
||||
# mainly usefull for testing
|
||||
notified_partner_ids = fields.Many2many(
|
||||
'res.partner', 'mail_message_res_partner_needaction_rel', string='Partners with Need Action',
|
||||
context={'active_test': False}, depends=['notification_ids'])
|
||||
context={'active_test': False}, depends=['notification_ids'], copy=False)
|
||||
needaction = fields.Boolean(
|
||||
'Need Action', compute='_get_needaction', search='_search_needaction',
|
||||
help='Need Action')
|
||||
|
||||
@@ -1000,20 +1000,12 @@ class MrpProduction(models.Model):
|
||||
def _update_raw_moves(self, factor):
|
||||
self.ensure_one()
|
||||
update_info = []
|
||||
move_to_unlink = self.env['stock.move']
|
||||
for move in self.move_raw_ids.filtered(lambda m: m.state not in ('done', 'cancel')):
|
||||
old_qty = move.product_uom_qty
|
||||
new_qty = old_qty * factor
|
||||
if new_qty > 0:
|
||||
move.write({'product_uom_qty': new_qty})
|
||||
move._action_assign()
|
||||
update_info.append((move, old_qty, new_qty))
|
||||
else:
|
||||
if move.quantity_done > 0:
|
||||
raise UserError(_('Lines need to be deleted, but can not as you still have some quantities to consume in them. '))
|
||||
move._action_cancel()
|
||||
move_to_unlink |= move
|
||||
move_to_unlink.unlink()
|
||||
move.write({'product_uom_qty': new_qty})
|
||||
move._action_assign()
|
||||
update_info.append((move, old_qty, new_qty))
|
||||
return update_info
|
||||
|
||||
def _get_ready_to_produce_state(self):
|
||||
|
||||
@@ -669,10 +669,10 @@ class TestMrpOrder(TestMrpCommon):
|
||||
mo.move_raw_ids.filtered(lambda m: m.state != 'done')[0].quantity_done = 0
|
||||
update_quantity_wizard.change_prod_qty()
|
||||
|
||||
self.assertEqual(len(mo.move_raw_ids), 2)
|
||||
self.assertEqual(len(mo.move_raw_ids), 4)
|
||||
|
||||
mo.button_mark_done()
|
||||
self.assertTrue(all(s == 'done' for s in mo.move_raw_ids.mapped('state')))
|
||||
self.assertTrue(all(s in ['done', 'cancel'] for s in mo.move_raw_ids.mapped('state')))
|
||||
self.assertEqual(sum(mo.move_raw_ids.mapped('move_line_ids.product_uom_qty')), 0)
|
||||
|
||||
def test_consumption_strict_1(self):
|
||||
|
||||
+18
-10
@@ -89,15 +89,20 @@ class Note(models.Model):
|
||||
def read_group(self, domain, fields, groupby, offset=0, limit=None, orderby=False, lazy=True):
|
||||
if groupby and groupby[0] == "stage_id" and (len(groupby) == 1 or lazy):
|
||||
stages = self.env['note.stage'].search([('user_id', '=', self.env.uid)])
|
||||
if stages: # if the user has some stages
|
||||
result = [{ # notes by stage for stages user
|
||||
'__context': {'group_by': groupby[1:]},
|
||||
'__domain': domain + [('stage_ids.id', '=', stage.id)],
|
||||
'stage_id': (stage.id, stage.name),
|
||||
'stage_id_count': self.search_count(domain + [('stage_ids', '=', stage.id)]),
|
||||
'__fold': stage.fold,
|
||||
} for stage in stages]
|
||||
|
||||
if stages:
|
||||
# if the user has some stages
|
||||
result = []
|
||||
for stage in stages:
|
||||
# notes by stage for stages user
|
||||
nb_stage_counts = self.search_count(domain + [('stage_ids', '=', stage.id)])
|
||||
result.append({
|
||||
'__context': {'group_by': groupby[1:]},
|
||||
'__domain': domain + [('stage_ids.id', '=', stage.id)],
|
||||
'stage_id': (stage.id, stage.name),
|
||||
'stage_id_count': nb_stage_counts,
|
||||
'__count': nb_stage_counts,
|
||||
'__fold': stage.fold,
|
||||
})
|
||||
# note without user's stage
|
||||
nb_notes_ws = self.search_count(domain + [('stage_ids', 'not in', stages.ids)])
|
||||
if nb_notes_ws:
|
||||
@@ -107,6 +112,7 @@ class Note(models.Model):
|
||||
dom_in = result[0]['__domain'].pop()
|
||||
result[0]['__domain'] = domain + ['|', dom_in, dom_not_in]
|
||||
result[0]['stage_id_count'] += nb_notes_ws
|
||||
result[0]['__count'] += nb_notes_ws
|
||||
else:
|
||||
# add the first stage column
|
||||
result = [{
|
||||
@@ -114,6 +120,7 @@ class Note(models.Model):
|
||||
'__domain': domain + [dom_not_in],
|
||||
'stage_id': (stages[0].id, stages[0].name),
|
||||
'stage_id_count': nb_notes_ws,
|
||||
'__count': nb_notes_ws,
|
||||
'__fold': stages[0].name,
|
||||
}] + result
|
||||
else: # if stage_ids is empty, get note without user's stage
|
||||
@@ -123,7 +130,8 @@ class Note(models.Model):
|
||||
'__context': {'group_by': groupby[1:]},
|
||||
'__domain': domain,
|
||||
'stage_id': False,
|
||||
'stage_id_count': nb_notes_ws
|
||||
'stage_id_count': nb_notes_ws,
|
||||
'__count': nb_notes_ws
|
||||
}]
|
||||
else:
|
||||
result = []
|
||||
|
||||
@@ -1926,7 +1926,7 @@ exports.Orderline = Backbone.Model.extend({
|
||||
var pack_lot_lines = json.pack_lot_ids;
|
||||
for (var i = 0; i < pack_lot_lines.length; i++) {
|
||||
var packlotline = pack_lot_lines[i][2];
|
||||
var pack_lot_line = new exports.Packlotline({}, {'json': _.extend(packlotline, {'order_line':this})});
|
||||
var pack_lot_line = new exports.Packlotline({}, {'json': _.extend({...packlotline}, {'order_line':this})});
|
||||
this.pack_lot_lines.add(pack_lot_line);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -233,6 +233,10 @@ class TestMessagePost(TestMailCommon, TestRecipients):
|
||||
self.assertFalse(self.env['mail.mail'].sudo().search([('mail_message_id', '=', msg.id)]),
|
||||
'message_post: mail.mail notifications should have been auto-deleted')
|
||||
|
||||
# notified_partner_ids should be empty after copying the message
|
||||
copy = msg.copy()
|
||||
self.assertFalse(copy.notified_partner_ids)
|
||||
|
||||
@mute_logger('flectra.addons.mail.models.mail_mail', 'flectra.tests')
|
||||
def test_post_notifications_keep_emails(self):
|
||||
self.test_record.message_subscribe(partner_ids=[self.user_admin.partner_id.id])
|
||||
|
||||
@@ -369,7 +369,9 @@ eventHandler.modules.popover.update = function ($popover, oStyle, isAirMode) {
|
||||
oStyle.anchor = false;
|
||||
}
|
||||
|
||||
if (oStyle.image || oStyle.anchor || (oStyle.range && !$(oStyle.range.sc).closest('.note-editable').length)) {
|
||||
if (oStyle.image || oStyle.anchor || (oStyle.range
|
||||
&& (!$(oStyle.range.sc).closest('.note-editable').length
|
||||
|| !$(oStyle.range.sc).parent().is(':o_editable')))) {
|
||||
$airPopover.hide();
|
||||
} else {
|
||||
$airPopover.show();
|
||||
|
||||
@@ -13,7 +13,6 @@ options.registry.SnippetPopup = options.Class.extend({
|
||||
this.$target.on('click.SnippetPopup', '.js_close_popup:not(a, .btn)', ev => {
|
||||
ev.stopPropagation();
|
||||
this.onTargetHide();
|
||||
this.trigger_up('snippet_option_visibility_update', {show: false});
|
||||
});
|
||||
this.$target.on('shown.bs.modal.SnippetPopup', () => {
|
||||
this.trigger_up('snippet_option_visibility_update', {show: true});
|
||||
|
||||
Reference in New Issue
Block a user