[MERGE] forward port branch 10.0 up to c2b3ad1899

This commit is contained in:
Christophe Simonis
2018-03-21 15:55:26 +01:00
22 changed files with 147 additions and 67 deletions
+5
View File
@@ -1071,6 +1071,11 @@ class AccountMoveLine(models.Model):
account_move_line.payment_id.write({'invoice_ids': [(3, invoice.id, None)]})
rec_move_ids += account_move_line.matched_debit_ids
rec_move_ids += account_move_line.matched_credit_ids
if self.env.context.get('invoice_id'):
current_invoice = self.env['account.invoice'].browse(self.env.context['invoice_id'])
rec_move_ids = rec_move_ids.filtered(
lambda r: (r.debit_move_id + r.credit_move_id) & current_invoice.move_id.line_ids
)
return rec_move_ids.unlink()
####################################################
@@ -620,3 +620,39 @@ class TestReconciliation(AccountingTestCase):
# Checking if the direction of the move is correct
full_rec_payable = full_rec_move.line_ids.filtered(lambda l: l.account_id == self.account_rsa)
self.assertEqual(full_rec_payable.balance, 18.75)
def test_unreconcile(self):
# Use case:
# 2 invoices paid with a single payment. Unreconcile the payment with one invoice, the
# other invoice should remain reconciled.
inv1 = self.create_invoice(invoice_amount=10, currency_id=self.currency_usd_id)
inv2 = self.create_invoice(invoice_amount=20, currency_id=self.currency_usd_id)
payment = self.env['account.payment'].create({
'payment_type': 'inbound',
'payment_method_id': self.env.ref('account.account_payment_method_manual_in').id,
'partner_type': 'customer',
'partner_id': self.partner_agrolait_id,
'amount': 100,
'currency_id': self.currency_usd_id,
'journal_id': self.bank_journal_usd.id,
})
payment.post()
credit_aml = payment.move_line_ids.filtered('credit')
# Check residual before assignation
self.assertAlmostEquals(inv1.residual, 10)
self.assertAlmostEquals(inv2.residual, 20)
# Assign credit and residual
inv1.assign_outstanding_credit(credit_aml.id)
inv2.assign_outstanding_credit(credit_aml.id)
self.assertAlmostEquals(inv1.residual, 0)
self.assertAlmostEquals(inv2.residual, 0)
# Unreconcile one invoice at a time and check residual
credit_aml.with_context(invoice_id=inv1.id).remove_move_reconcile()
self.assertAlmostEquals(inv1.residual, 10)
self.assertAlmostEquals(inv2.residual, 0)
credit_aml.with_context(invoice_id=inv2.id).remove_move_reconcile()
self.assertAlmostEquals(inv1.residual, 10)
self.assertAlmostEquals(inv2.residual, 20)
+13 -2
View File
@@ -204,8 +204,6 @@
<group>
<field name="name" string="Opportunity Title" placeholder="e.g. Customer Deal"/>
<field name="partner_id" domain="[('customer', '=', True)]" context="{'search_default_customer': 1}"/>
<field name="email_from" invisible="1"/>
<field name="phone" invisible="1"/>
<label for="planned_revenue"/>
<div class="o_row">
<field name="planned_revenue"/>
@@ -218,6 +216,19 @@
<button string="Create" name="close_dialog" type="object" class="btn-primary"/>
<button string="Discard" class="btn-default" special="cancel"/>
</footer>
<field name="partner_name" invisible="1"/>
<field name="contact_name" invisible="1"/>
<field name="title" invisible="1"/>
<field name="street" invisible="1"/>
<field name="street2" invisible="1"/>
<field name="city" invisible="1"/>
<field name="state_id" invisible="1"/>
<field name="country_id" invisible="1"/>
<field name="email_from" invisible="1"/>
<field name="phone" invisible="1"/>
<field name="mobile" invisible="1"/>
<field name="zip" invisible="1"/>
<field name="function" invisible="1"/>
</sheet>
</form>
</field>
+24 -24
View File
@@ -603,7 +603,7 @@ msgstr "Bankverbindlichkeiten"
#: model:account.account,name:l10n_ch.1_ch_coa_2160
#: model:account.account.template,name:l10n_ch.ch_coa_2160
msgid "Dettes envers l'actionnaire"
msgstr ""
msgstr "Gesellschafterverbindlichkeiten"
#. module: l10n_ch
#: model:account.account,name:l10n_ch.1_ch_coa_3806
@@ -611,7 +611,7 @@ msgstr ""
#: model:account.account.template,name:l10n_ch.ch_coa_3806
#: model:account.account.template,name:l10n_ch.ch_coa_4906
msgid "Différences de change"
msgstr ""
msgstr "Währungsdifferenzen"
#. module: l10n_ch
#: model:account.account,name:l10n_ch.1_ch_coa_2261
@@ -623,7 +623,7 @@ msgstr "Beschlossene Ausschüttungen"
#: model:account.account,name:l10n_ch.1_ch_coa_4071
#: model:account.account.template,name:l10n_ch.ch_coa_4071
msgid "Droits de douanes à l'importation"
msgstr ""
msgstr "Einfuhrzölle"
#. module: l10n_ch
#: model:account.account,name:l10n_ch.1_ch_coa_1109
@@ -647,7 +647,7 @@ msgstr "Abrechnungskonto MWST"
#: model:account.account,name:l10n_ch.1_ch_coa_4009
#: model:account.account.template,name:l10n_ch.ch_coa_4009
msgid "Déductions obtenues sur achats"
msgstr ""
msgstr "Einkaufsrabatte"
#. module: l10n_ch
#: model:account.account,name:l10n_ch.1_ch_coa_3009
@@ -713,7 +713,7 @@ msgstr "Unterhalt, Reparaturen, Ersatz mobile Sachanlagen"
#: model:account.account,name:l10n_ch.1_ch_coa_1570
#: model:account.account.template,name:l10n_ch.ch_coa_1570
msgid "Equipements et Installations"
msgstr ""
msgstr "Feste Einrichtungen und Installationen"
#. module: l10n_ch
#: model:account.account,name:l10n_ch.1_ch_coa_3800
@@ -721,7 +721,7 @@ msgstr ""
#: model:account.account.template,name:l10n_ch.ch_coa_3800
#: model:account.account.template,name:l10n_ch.ch_coa_4900
msgid "Escomptes"
msgstr ""
msgstr "Erlösminderungen"
#. module: l10n_ch
#: model:account.account,name:l10n_ch.1_ch_coa_4530
@@ -733,31 +733,31 @@ msgstr "Benzin"
#: model:account.account,name:l10n_ch.1_ch_coa_3804
#: model:account.account.template,name:l10n_ch.ch_coa_3804
msgid "Frais d'encaissement"
msgstr "Frais d'encaissement"
msgstr "Inkassoaufwand"
#. module: l10n_ch
#: model:account.account,name:l10n_ch.1_ch_coa_3807
#: model:account.account.template,name:l10n_ch.ch_coa_3807
msgid "Frais d'expédition"
msgstr "Frais d'expédition"
msgstr "Versandkosten"
#. module: l10n_ch
#: model:account.account,name:l10n_ch.1_ch_coa_4072
#: model:account.account.template,name:l10n_ch.ch_coa_4072
msgid "Frais de transport à l'achat"
msgstr "Frais de transport à l'achat"
msgstr "Transportkosten"
#. module: l10n_ch
#: model:account.account,name:l10n_ch.1_ch_coa_4070
#: model:account.account.template,name:l10n_ch.ch_coa_4070
msgid "Frêts à l'achat"
msgstr ""
msgstr "Frachtkosten"
#. module: l10n_ch
#: model:account.account,name:l10n_ch.1_ch_coa_4510
#: model:account.account.template,name:l10n_ch.ch_coa_4510
msgid "Gaz"
msgstr "Gaz"
msgstr "Gas"
#. module: l10n_ch
#: model:account.account,name:l10n_ch.1_ch_coa_1770
@@ -991,7 +991,7 @@ msgstr "Beteiligungen"
#: model:account.account,name:l10n_ch.1_ch_coa_4086
#: model:account.account.template,name:l10n_ch.ch_coa_4086
msgid "Pertes de matières"
msgstr ""
msgstr "Warenschwund"
#. module: l10n_ch
#: model:account.account,name:l10n_ch.1_ch_coa_3805
@@ -1124,13 +1124,13 @@ msgstr "Werbeaufwand"
#: model:account.account,name:l10n_ch.1_ch_coa_3801
#: model:account.account.template,name:l10n_ch.ch_coa_3801
msgid "Rabais et réduction de prix"
msgstr ""
msgstr "Rabatte und Preisreduktionen"
#. module: l10n_ch
#: model:account.account,name:l10n_ch.1_ch_coa_4901
#: model:account.account.template,name:l10n_ch.ch_coa_4901
msgid "Rabais et réductions de prix"
msgstr ""
msgstr "Rabatte und Preisreduktionen"
#. module: l10n_ch
#: model:account.account,name:l10n_ch.1_ch_coa_3802
@@ -1138,7 +1138,7 @@ msgstr ""
#: model:account.account.template,name:l10n_ch.ch_coa_3802
#: model:account.account.template,name:l10n_ch.ch_coa_4092
msgid "Ristournes"
msgstr ""
msgstr "Rückvergütungen"
#. module: l10n_ch
#: model:account.account,name:l10n_ch.1_ch_coa_2940
@@ -1472,13 +1472,13 @@ msgstr "Wertschriften"
#: model:account.account,name:l10n_ch.1_transfer_account_id
#: model:account.account.template,name:l10n_ch.transfer_account_id
msgid "Transferts internes"
msgstr ""
msgstr "Interne Verrechnungen"
#. module: l10n_ch
#: model:account.account,name:l10n_ch.1_ch_coa_1280
#: model:account.account.template,name:l10n_ch.ch_coa_1280
msgid "Travaux en cours"
msgstr "Unfertige Erzeugnisse"
msgstr "Nicht fakturierte Dienstleistungen"
#. module: l10n_ch
#: model:account.account,name:l10n_ch.1_ch_coa_3940
@@ -1490,19 +1490,19 @@ msgstr "Bestandesänderungen nicht fakturierte Dienstleistungen"
#: model:account.account,name:l10n_ch.1_ch_coa_1287
#: model:account.account.template,name:l10n_ch.ch_coa_1287
msgid "Variation de la valeur des travaux en cours"
msgstr ""
msgstr "Bestandesänderungen nicht fakturierte Dienstleistungen"
#. module: l10n_ch
#: model:account.account,name:l10n_ch.1_ch_coa_1277
#: model:account.account.template,name:l10n_ch.ch_coa_1277
msgid "Variation de stock produits semi-ouvrés"
msgstr ""
msgstr "Bestandesänderungen unfertige Erzeugnisse"
#. module: l10n_ch
#: model:account.account,name:l10n_ch.1_ch_coa_1267
#: model:account.account.template,name:l10n_ch.ch_coa_1267
msgid "Variation de stocks de produits finis"
msgstr ""
msgstr "Bestandesänderungen fertige Erzeugnisse"
#. module: l10n_ch
#: model:account.account,name:l10n_ch.1_ch_coa_1207
@@ -1510,13 +1510,13 @@ msgstr ""
#: model:account.account.template,name:l10n_ch.ch_coa_1207
#: model:account.account.template,name:l10n_ch.ch_coa_4800
msgid "Variation des stocks de marchandises"
msgstr ""
msgstr "Bestandesänderungen Handelsware"
#. module: l10n_ch
#: model:account.account,name:l10n_ch.1_ch_coa_4801
#: model:account.account.template,name:l10n_ch.ch_coa_4801
msgid "Variation des stocks de matières premières"
msgstr ""
msgstr "Bestandesänderungen Rohstoffe"
#. module: l10n_ch
#: model:account.account,name:l10n_ch.1_ch_coa_3901
@@ -1534,7 +1534,7 @@ msgstr "Bestandesänderungen unfertige Erzeugnisse"
#: model:account.account,name:l10n_ch.1_ch_coa_1217
#: model:account.account.template,name:l10n_ch.ch_coa_1217
msgid "Variation des stocks des matières premières"
msgstr ""
msgstr "Bestandesänderungen Rohstoffe"
#. module: l10n_ch
#: model:account.account,name:l10n_ch.1_ch_coa_4008
@@ -1542,7 +1542,7 @@ msgstr ""
#: model:account.account.template,name:l10n_ch.ch_coa_4008
#: model:account.account.template,name:l10n_ch.ch_coa_4080
msgid "Variations de stocks"
msgstr ""
msgstr "Inventurdifferenzen"
#. module: l10n_ch
#: model:account.account,name:l10n_ch.1_ch_coa_3200
@@ -721,6 +721,8 @@ class MassMailing(models.Model):
def _process_mass_mailing_queue(self):
mass_mailings = self.search([('state', 'in', ('in_queue', 'sending')), '|', ('schedule_date', '<', fields.Datetime.now()), ('schedule_date', '=', False)])
for mass_mailing in mass_mailings:
user = mass_mailing.write_uid or self.env.user
mass_mailing = mass_mailing.with_context(**user.sudo(user=user).context_get())
if len(mass_mailing.get_remaining_recipients()) > 0:
mass_mailing.state = 'sending'
mass_mailing.send_mail()
+1 -1
View File
@@ -346,7 +346,7 @@ class PricelistItem(models.Model):
'product.category', 'Product Category', ondelete='cascade',
help="Specify a product category if this rule only applies to products belonging to this category or its children categories. Keep empty otherwise.")
min_quantity = fields.Integer(
'Min. Quantity', default=1,
'Min. Quantity', default=0,
help="For the rule to apply, bought/sold quantity must be greater "
"than or equal to the minimum quantity specified in this field.\n"
"Expressed in the default unit of measure of the product.")
+2 -1
View File
@@ -1169,5 +1169,6 @@ class MailComposeMessage(models.TransientModel):
@api.multi
def send_mail(self, auto_commit=False):
if self._context.get('default_model') == 'purchase.order' and self._context.get('default_res_id'):
self = self.with_context(mail_post_autofollow=True)
self.mail_purchase_order_on_send()
return super(MailComposeMessage, self.with_context(mail_post_autofollow=True)).send_mail(auto_commit=auto_commit)
return super(MailComposeMessage, self).send_mail(auto_commit=auto_commit)
+4 -20
View File
@@ -53,20 +53,19 @@
<thead>
<tr>
<th><strong>Product</strong></th>
<th><strong>Ordered Quantity</strong></th>
<th><strong>Quantity</strong></th>
</tr>
</thead>
<tbody>
<tr t-foreach="o.move_lines" t-as="move">
<td><span t-field="move.product_id"/></td>
<td>
<span t-field="move.ordered_qty"/>
<span t-field="move.product_uom_qty"/>
<span t-field="move.product_uom"/>
</td>
</tr>
</tbody>
</table>
<t t-set="backorder" t-value="False"/>
<table class="table table-condensed mt48" t-if="o.pack_operation_ids">
<t t-set="has_serial_number" t-value="o.pack_operation_ids.filtered('pack_lot_ids')" groups="stock.group_production_lot"/>
<thead>
@@ -75,10 +74,7 @@
<th name="lot_serial" t-if="has_serial_number">
<span class="pull-left">Lot/Serial Number</span>
</th>
<th class="text-center"><strong>Ordered Quantity</strong></th>
<th t-if="any([pack_operation.state == 'done' for pack_operation in o.pack_operation_ids])" class="text-right">
<strong>Delivered Quantity</strong>
</th>
<th class="text-center"><strong>Quantity</strong></th>
</tr>
</thead>
<tbody>
@@ -116,18 +112,6 @@
<td class="text-center">
<span t-if="pack_operation.package_id">:</span>
<span t-field="pack_operation.package_id"/>
<span t-field="pack_operation.ordered_qty"/>
<t t-if="pack_operation.linked_move_operation_ids">
<span t-field="pack_operation.linked_move_operation_ids[0].move_id.product_uom"></span>
</t>
<t t-else="1">
<span t-field="pack_operation.product_uom_id"></span>
</t>
</td>
<td class="text-right" t-if="pack_operation.state == 'done'">
<t t-if="pack_operation.ordered_qty != pack_operation.qty_done_uom_ordered">
<t t-set="backorder" t-value="True"/>
</t>
<span t-field="pack_operation.qty_done_uom_ordered"/>
<t t-if="pack_operation.linked_move_operation_ids">
<span t-field="pack_operation.linked_move_operation_ids[0].move_id.product_uom"></span>
@@ -143,7 +127,7 @@
This shipment is a backorder of <t t-esc="o.backorder_id.name"/>.
</p>
<p>
<t t-if="backorder">
<t t-if="o.search([('backorder_id', '=', o.id), ('state', 'not in', ['cancel', 'done'])])">
All items couldn't be shipped, the remaining ones will be shipped as soon as they become available.
</t>
</p>
@@ -44,6 +44,8 @@ class AccountInvoiceLine(models.Model):
def _get_anglo_saxon_price_unit(self):
self.ensure_one()
if not self.product_id:
return self.price_unit
return self.product_id._get_anglo_saxon_price_unit(uom=self.uom_id)
def _get_price(self, company_currency, price_unit):
+1 -1
View File
@@ -46,7 +46,7 @@
<field name="name">Public access to user_input</field>
<field name="model_id" ref="survey.model_survey_user_input"/>
<field name="domain_force">[('create_uid', '=', user.id)]</field>
<field name="groups" eval="[(4, ref('base.group_public'))]"/>
<field name="groups" eval="[(4, ref('base.group_user')), (4, ref('base.group_portal')), (4, ref('base.group_public'))]"/>
<field eval="0" name="perm_unlink"/>
<field eval="0" name="perm_write"/>
<field eval="1" name="perm_read"/>
+1 -1
View File
@@ -963,7 +963,7 @@ class Binary(http.Controller):
'/web/content/<int:id>-<string:unique>/<string:filename>',
'/web/content/<string:model>/<int:id>/<string:field>',
'/web/content/<string:model>/<int:id>/<string:field>/<string:filename>'], type='http', auth="public")
def content_common(self, xmlid=None, model='ir.attachment', id=None, field='datas', filename=None, filename_field='datas_fname', unique=None, mimetype=None, download=None, data=None, token=None):
def content_common(self, xmlid=None, model='ir.attachment', id=None, field='datas', filename=None, filename_field='datas_fname', unique=None, mimetype=None, download=None, data=None, token=None, **kw):
status, headers, content = binary_content(xmlid=xmlid, model=model, id=id, field=field, unique=unique, filename=filename, filename_field=filename_field, download=download, mimetype=mimetype)
if status == 304:
response = werkzeug.wrappers.Response(status=status, headers=headers)
@@ -1441,13 +1441,11 @@ var FieldStatus = common.AbstractField.extend({
// For field type selection filter values according to
// statusbar_visible attribute of the field. For example:
// statusbar_visible="draft,open".
var select = this.field.selection;
for(var i=0; i < select.length; i++) {
var key = select[i][0];
if(key === this.get('value') || !this.options.visible || this.options.visible.indexOf(key) !== -1) {
selection_unfolded.push(select[i]);
}
}
var restriction = _.isString(this.options.visible) ? this.options.visible.split(',') : [];
selection_unfolded = _.filter(this.field.selection, function (val) {
return val[0] === self.get('value') || !self.options.visible || _.contains(restriction, val[0]);
});
return $.when();
}
}, this);
+2 -2
View File
@@ -104,8 +104,8 @@
and main_object.website_meta_description or website_meta_description"/>
<t t-set="meta_keywords" t-value="main_object and 'website_meta_keywords' in main_object
and main_object.website_meta_keywords or website_meta_keywords"/>
<meta t-if="meta_description" name="description" t-att-content="meta_description"/>
<meta t-if="meta_keywords" name="keywords" t-att-content="meta_keywords"/>
<meta t-if="meta_description or editable" name="description" t-att-content="meta_description"/>
<meta t-if="meta_keywords or editable" name="keywords" t-att-content="meta_keywords"/>
<!-- OpenGraph tags for Facebook sharing -->
<meta property="og:title" t-att-content="additional_title" />
@@ -207,7 +207,7 @@
<select name="country_id" class="form-control">
<option value="">Country...</option>
<t t-foreach="countries or []" t-as="country">
<option t-att-value="country.id" t-att-selected="country.id == partner.country_id.id">
<option t-att-value="country.id" t-att-selected="country.id == int(country_id) if country_id else country.id == partner.country_id.id">
<t t-esc="country.name" />
</option>
</t>
+10 -2
View File
@@ -11,7 +11,11 @@ class Project(models.Model):
""" Instead of the classic form view, redirect to website for portal users
that can read the project. """
self.ensure_one()
if self.env.user.share:
if self.env.context.get('uid'):
user = self.env['res.users'].browse(self.env.context['uid'])
else:
user = self.env.user
if user.share:
try:
self.check_access_rule('read')
except exceptions.AccessError:
@@ -43,7 +47,11 @@ class Task(models.Model):
""" Instead of the classic form view, redirect to website for portal users
that can read the task. """
self.ensure_one()
if self.env.user.share:
if self.env.context.get('uid'):
user = self.env['res.users'].browse(self.env.context['uid'])
else:
user = self.env.user
if user.share:
try:
self.check_access_rule('read')
except exceptions.AccessError:
@@ -13,7 +13,11 @@ class Issue(models.Model):
""" Instead of the classic form view, redirect to website for portal users
that can read the issue. """
self.ensure_one()
if self.env.user.share:
if self.env.context.get('uid'):
user = self.env['res.users'].browse(self.env.context['uid'])
else:
user = self.env.user
if user.share:
try:
self.check_access_rule('read')
except exceptions.AccessError:
@@ -32,6 +36,9 @@ class Issue(models.Model):
groups = super(Issue, self)._notification_recipients(message, groups)
for group_name, group_method, group_data in groups:
if group_name in ["customer", "portal"]:
continue
group_data['has_button_access'] = True
return groups
+2 -1
View File
@@ -1347,7 +1347,8 @@
<div t-esc="int(line.product_uom_qty) == line.product_uom_qty and int(line.product_uom_qty) or line.product_uom_qty" />
</td>
<td class="text-center td-price">
<span t-field="line.price_unit" style="white-space: nowrap;" t-options="{'widget': 'monetary','from_currency': website_sale_order.pricelist_id.currency_id,'display_currency': website.currency_id}" />
<span t-field="line.price_reduce_taxexcl" style="white-space: nowrap;" t-options="{'widget': 'monetary', 'from_currency': website_sale_order.pricelist_id.currency_id, 'display_currency': website.currency_id}" groups="sale.group_show_price_subtotal" />
<span t-field="line.price_reduce_taxinc" style="white-space: nowrap;" t-options="{'widget': 'monetary', 'from_currency': website_sale_order.pricelist_id.currency_id, 'display_currency': website.currency_id}" groups="sale.group_show_price_total" />
</td>
</tr>
</tbody>
@@ -27,7 +27,10 @@ class SaleOrder(models.Model):
@api.depends('order_line.price_unit', 'order_line.tax_id', 'order_line.discount', 'order_line.product_uom_qty')
def _compute_amount_delivery(self):
for order in self:
order.amount_delivery = sum(order.order_line.filtered('is_delivery').mapped('price_subtotal'))
if self.env.user.has_group('sale.group_show_price_subtotal'):
order.amount_delivery = sum(order.order_line.filtered('is_delivery').mapped('price_subtotal'))
else:
order.amount_delivery = sum(order.order_line.filtered('is_delivery').mapped('price_total'))
@api.depends('order_line.is_delivery')
def _compute_has_delivery(self):
+11
View File
@@ -0,0 +1,11 @@
Austria, 18th of March 2018
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,
Andreas Perhab bigbear.ap@gmx.at https://github.com/bigbear3001
+11
View File
@@ -0,0 +1,11 @@
Switzerland, 2018-03-20
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,
Andreas Hochuli a.hochuli@hispeed.ch https://github.com/Highcooley
+1 -1
View File
@@ -481,7 +481,7 @@ Source installation requires manually installing dependencies:
$ sudo npm install -g less
- on Windows, `install nodejs <http://nodejs.org/download/>`_, reboot (to
- on Windows, `install nodejs <https://nodejs.org/en/download/>`_, reboot (to
update the :envvar:`PATH`) and install less:
.. code-block:: ps1
+1 -1
View File
@@ -125,7 +125,7 @@ class IrActionsReportXml(models.Model):
def _compute_report_sxw(self):
for report in self:
if report.report_rml:
self.report_sxw = report.report_rml.replace('.rml', '.sxw')
report.report_sxw = report.report_rml.replace('.rml', '.sxw')
def _report_content(self, name):
data = self[name + '_content_data']