[MERGE] forward port branch 11.0 up to 1385b60004
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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
|
||||
#######################
|
||||
|
||||
@@ -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"/>
|
||||
|
||||
@@ -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' : ''}">
|
||||
|
||||
@@ -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"/>
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ safe_attrs = clean.defs.safe_attrs | frozenset(
|
||||
['style',
|
||||
'data-o-mail-quote', # quote detection
|
||||
'data-oe-model', 'data-oe-id', 'data-oe-field', 'data-oe-type', 'data-oe-expression', 'data-oe-translation-id', 'data-oe-nodeid',
|
||||
'data-publish', 'data-id', 'data-res_id', 'data-member_id', 'data-view-id'
|
||||
'data-publish', 'data-id', 'data-res_id', 'data-interval', 'data-member_id', 'data-scroll-background-ratio', 'data-view-id',
|
||||
])
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user