diff options
| author | Christophe Simonis <chs@odoo.com> | 2019-08-27 16:06:01 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2019-08-27 16:06:01 +0200 |
| commit | 838b3f2d827daa1d1fb945de34345c7f9ca4f1b0 (patch) | |
| tree | dc83ea0600959ebeaf50d752d9cfa78c2c51a6f0 /addons | |
| parent | 4833aeb960fdf72bbb55721c3e2f4c83b27d2cbd (diff) | |
| parent | 1385b60004dde5e2b1738161280d979f60cc0418 (diff) | |
[MERGE] forward port branch 11.0 up to 1385b60004d
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/account/models/account.py | 2 | ||||
| -rw-r--r-- | addons/account/models/account_move.py | 2 | ||||
| -rw-r--r-- | addons/account/tests/test_reconciliation.py | 62 | ||||
| -rw-r--r-- | addons/account_check_printing/models/account_payment.py | 5 | ||||
| -rw-r--r-- | addons/account_check_printing/views/account_payment_views.xml | 1 | ||||
| -rw-r--r-- | addons/gamification/views/goal.xml | 5 | ||||
| -rw-r--r-- | addons/hr_recruitment/views/hr_recruitment_views.xml | 1 | ||||
| -rw-r--r-- | addons/maintenance/views/maintenance_views.xml | 8 | ||||
| -rw-r--r-- | addons/point_of_sale/static/src/js/screens.js | 5 | ||||
| -rw-r--r-- | addons/website/models/website.py | 7 | ||||
| -rw-r--r-- | addons/website_event_sale/models/sale_order.py | 5 | ||||
| -rw-r--r-- | addons/website_event_track/models/event_track.py | 2 |
12 files changed, 90 insertions, 15 deletions
diff --git a/addons/account/models/account.py b/addons/account/models/account.py index e8900d9df93..bf28883db65 100644 --- a/addons/account/models/account.py +++ b/addons/account/models/account.py @@ -725,7 +725,7 @@ class AccountJournal(models.Model): @api.depends('company_id') def _belong_to_company(self): for journal in self: - journal.belong_to_company = (journal.company_id.id == self.env.user.company_id.id) + journal.belongs_to_company = (journal.company_id.id == self.env.user.company_id.id) @api.multi def _search_company_journals(self, operator, value): diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 6c820d7ad1b..78e02972e92 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -372,7 +372,7 @@ class AccountMoveLine(models.Model): else: date = partial_line.credit_move_id.date if partial_line.debit_move_id == line else partial_line.debit_move_id.date rate = line.currency_id.with_context(date=date).rate - amount_residual_currency += sign_partial_line * partial_line.amount * rate + amount_residual_currency += sign_partial_line * line.currency_id.round(partial_line.amount * rate) #computing the `reconciled` field. reconciled = False diff --git a/addons/account/tests/test_reconciliation.py b/addons/account/tests/test_reconciliation.py index 78b42d59e32..5bcb87accf0 100644 --- a/addons/account/tests/test_reconciliation.py +++ b/addons/account/tests/test_reconciliation.py @@ -1050,3 +1050,65 @@ class TestReconciliation(AccountingTestCase): # because they owe us still 50 CC. self.assertEqual(invoice_cust_1.state, 'open', 'Invoice is in status %s' % invoice_cust_1.state) + + def test_inv_refund_foreign_payment_writeoff_domestic(self): + company = self.env.ref('base.main_company') + self.env['res.currency.rate'].search([]).unlink() + self.env['res.currency.rate'].create({ + 'name': time.strftime('%Y') + '-07-01', + 'rate': 1.0, + 'currency_id': self.currency_euro_id, + 'company_id': company.id + }) + self.env['res.currency.rate'].create({ + 'name': time.strftime('%Y') + '-07-01', + 'rate': 1.113900, # Don't change this ! + 'currency_id': self.currency_usd_id, + 'company_id': self.env.ref('base.main_company').id + }) + inv1 = self.create_invoice(invoice_amount=480, currency_id=self.currency_usd_id) + inv2 = self.create_invoice(type="out_refund", invoice_amount=140, currency_id=self.currency_usd_id) + + payment = self.env['account.payment'].create({ + 'payment_method_id': self.inbound_payment_method.id, + 'payment_type': 'inbound', + 'partner_type': 'customer', + 'partner_id': inv1.partner_id.id, + 'amount': 287.20, + 'journal_id': self.bank_journal_euro.id, + 'company_id': company.id, + }) + payment.post() + + inv1_receivable = inv1.move_id.line_ids.filtered(lambda l: l.account_id.internal_type == 'receivable') + inv2_receivable = inv2.move_id.line_ids.filtered(lambda l: l.account_id.internal_type == 'receivable') + pay_receivable = payment.move_line_ids.filtered(lambda l: l.account_id.internal_type == 'receivable') + + data_for_reconciliation = [ + { + 'type': 'partner', + 'id': inv1.partner_id.id, + 'mv_line_ids': (inv1_receivable + inv2_receivable + pay_receivable).ids, + 'new_mv_line_dicts': [ + { + 'credit': 18.04, + 'debit': 0.00, + 'journal_id': self.bank_journal_euro.id, + 'name': 'Total WriteOff (Fees)', + 'account_id': self.diff_expense_account.id + } + ] + } + ] + + self.env['account.move.line'].process_reconciliations(data_for_reconciliation) + + self.assertTrue(inv1_receivable.full_reconcile_id.exists()) + self.assertEquals(inv1_receivable.full_reconcile_id, inv2_receivable.full_reconcile_id) + self.assertEquals(inv1_receivable.full_reconcile_id, pay_receivable.full_reconcile_id) + + self.assertTrue(inv1.reconciled) + self.assertTrue(inv2.reconciled) + + self.assertEquals(inv1.state, 'paid') + self.assertEquals(inv2.state, 'paid') diff --git a/addons/account_check_printing/models/account_payment.py b/addons/account_check_printing/models/account_payment.py index 28e9f285c1d..235bf96b52b 100644 --- a/addons/account_check_printing/models/account_payment.py +++ b/addons/account_check_printing/models/account_payment.py @@ -115,6 +115,11 @@ class AccountPayment(models.Model): """ This method is a hook for l10n_xx_check_printing modules to implement actual check printing capabilities """ raise UserError(_("You have to choose a check layout. For this, go in Apps, search for 'Checks layout' and install one.")) + + def set_check_amount_in_words(self): + for payment in self: + payment.check_amount_in_words = payment.currency_id.amount_to_text(payment.amount) if payment.currency_id else '' + ####################### #CHECK PRINTING METHODS ####################### diff --git a/addons/account_check_printing/views/account_payment_views.xml b/addons/account_check_printing/views/account_payment_views.xml index 56e3944b9d7..596449f9474 100644 --- a/addons/account_check_printing/views/account_payment_views.xml +++ b/addons/account_check_printing/views/account_payment_views.xml @@ -8,6 +8,7 @@ <xpath expr="//button[@name='post']" position="before"> <button name="print_checks" class="oe_highlight" attrs="{'invisible': ['|', ('payment_method_code', '!=', 'check_printing'), ('state', '!=', 'posted')]}" string="Print Check" type="object"/> <button name="unmark_sent" attrs="{'invisible': ['|', ('payment_method_code', '!=', 'check_printing'), ('state', '!=', 'sent')]}" string="Unmark Sent" type="object"/> + <button name="set_check_amount_in_words" attrs="{'invisible': ['|', ('payment_method_code', '!=', 'check_printing'), ('check_amount_in_words', '!=', False)]}" string="Reset Amount in Words" type="object" groups="base.group_no_one"/> </xpath> <xpath expr="//div[@name='amount_div']" position="after"> <field name="check_amount_in_words" attrs="{'invisible': [('payment_method_code', '!=', 'check_printing')], 'readonly': [('state', '!=', 'draft')]}" groups="base.group_no_one"/> diff --git a/addons/gamification/views/goal.xml b/addons/gamification/views/goal.xml index 31852c1a049..917ee095022 100644 --- a/addons/gamification/views/goal.xml +++ b/addons/gamification/views/goal.xml @@ -135,6 +135,7 @@ <field name="completeness"/> <field name="state"/> <field name="target_goal"/> + <field name="definition_description"/> <field name="definition_condition"/> <field name="definition_suffix"/> <field name="definition_display"/> @@ -143,7 +144,9 @@ <field name="last_update"/> <templates> <t t-name="kanban-tooltip"> - <field name="definition_description"/> + <ul class="oe_kanban_tooltip"> + <li><t t-esc="record.definition_description.value" /></li> + </ul> </t> <t t-name="kanban-box"> <div t-attf-class="oe_kanban_card o_kanban_gamification #{record.end_date.raw_value < record.last_update.raw_value & record.state.raw_value == 'failed' ? 'oe_kanban_color_2' : ''} #{record.end_date.raw_value < record.last_update.raw_value & record.state.raw_value == 'reached' ? 'oe_kanban_color_5' : ''}"> diff --git a/addons/hr_recruitment/views/hr_recruitment_views.xml b/addons/hr_recruitment/views/hr_recruitment_views.xml index dba4df12325..08395d9fc21 100644 --- a/addons/hr_recruitment/views/hr_recruitment_views.xml +++ b/addons/hr_recruitment/views/hr_recruitment_views.xml @@ -269,6 +269,7 @@ <field name="user_email"/> <field name="partner_name"/> <field name="type_id"/> + <field name="partner_id"/> <field name="job_id"/> <field name="department_id"/> <field name="message_needaction_counter"/> diff --git a/addons/maintenance/views/maintenance_views.xml b/addons/maintenance/views/maintenance_views.xml index 2a3f2e4b8d3..71b237890bb 100644 --- a/addons/maintenance/views/maintenance_views.xml +++ b/addons/maintenance/views/maintenance_views.xml @@ -126,8 +126,8 @@ <templates> <t t-name="kanban-tooltip"> <ul class="oe_kanban_tooltip"> - <li><b>Category:</b> <field name="category_id"/></li> - <li><b>Request to:</b> <field name="technician_user_id"/></li> + <li t-if="record.category_id.raw_value"><b>Category:</b> <t t-esc="record.category_id.value"/></li> + <li t-if="record.technician_user_id.raw_value"><b>Request to:</b> <t t-esc="record.technician_user_id.value"/></li> </ul> </t> <t t-name="kanban-box"> @@ -423,8 +423,8 @@ <templates> <t t-name="kanban-tooltip"> <ul class="oe_kanban_tooltip"> - <li><b>Serial Number:</b> <field name="serial_no"/></li> - <li><b>Model Number:</b> <field name="model"/></li> + <li t-if="record.serial_no.raw_value"><b>Serial Number:</b> <t t-esc="record.serial_no.value"/></li> + <li t-if="record.model.raw_value"><b>Model Number:</b> <t t-esc="record.model.value"/></li> </ul> </t> <t t-name="kanban-box"> diff --git a/addons/point_of_sale/static/src/js/screens.js b/addons/point_of_sale/static/src/js/screens.js index a2b34025c08..96a9cf67c2f 100644 --- a/addons/point_of_sale/static/src/js/screens.js +++ b/addons/point_of_sale/static/src/js/screens.js @@ -102,7 +102,10 @@ var ScreenWidget = PosBaseWidget.extend({ barcode_client_action: function(code){ var partner = this.pos.db.get_partner_by_barcode(code.code); if(partner){ - this.pos.get_order().set_client(partner); + if (this.pos.get_order().get_client() !== partner) { + this.pos.get_order().set_client(partner); + this.pos.get_order().set_pricelist(_.findWhere(this.pos.pricelists, {'id': partner.property_product_pricelist[0]}) || this.pos.default_pricelist); + } return true; } this.barcode_error_action(code); diff --git a/addons/website/models/website.py b/addons/website/models/website.py index 79b8072b283..49682267d1c 100644 --- a/addons/website/models/website.py +++ b/addons/website/models/website.py @@ -517,9 +517,6 @@ class Website(models.Model): domain_part, url = rule.build(value, append_unknown=False) if not query_string or query_string.lower() in url.lower(): page = {'loc': url} - for key, val in value.items(): - if key.startswith('__'): - page[key[2:]] = val if url in ('/sitemap.xml',): continue if url in url_set: @@ -543,9 +540,9 @@ class Website(models.Model): for page in pages: record = {'loc': page['url'], 'id': page['id'], 'name': page['name']} if page.view_id and page.view_id.priority != 16: - record['__priority'] = min(round(page.view_id.priority / 32.0, 1), 1) + record['priority'] = min(round(page.view_id.priority / 32.0, 1), 1) if page['write_date']: - record['__lastmod'] = page['write_date'][:10] + record['lastmod'] = page['write_date'][:10] yield record @api.multi diff --git a/addons/website_event_sale/models/sale_order.py b/addons/website_event_sale/models/sale_order.py index 58c56bc9441..05e81f2605b 100644 --- a/addons/website_event_sale/models/sale_order.py +++ b/addons/website_event_sale/models/sale_order.py @@ -41,7 +41,10 @@ class SaleOrder(models.Model): values['product_id'] = ticket.product_id.id values['event_id'] = ticket.event_id.id values['event_ticket_id'] = ticket.id - values['price_unit'] = ticket.price_reduce + if order.pricelist_id.discount_policy == 'without_discount': + values['price_unit'] = ticket.price + else: + values['price_unit'] = ticket.price_reduce values['name'] = "%s\n%s" % (ticket.event_id.display_name, ticket.name) # avoid writing related values that end up locking the product record diff --git a/addons/website_event_track/models/event_track.py b/addons/website_event_track/models/event_track.py index 62d1afff823..84574bf3236 100644 --- a/addons/website_event_track/models/event_track.py +++ b/addons/website_event_track/models/event_track.py @@ -155,7 +155,7 @@ class Track(models.Model): def message_get_suggested_recipients(self): recipients = super(Track, self).message_get_suggested_recipients() for track in self: - if track.partner_email != track.partner_id.email: + if track.partner_email and track.partner_email != track.partner_id.email: track._message_add_suggested_recipient(recipients, email=track.partner_email, reason=_('Speaker Email')) return recipients |
