Permalink
Browse files

[MERGE] forward port branch 10.0 up to e6ff16c

  • Loading branch information...
KangOl committed Nov 7, 2018
2 parents 03a3539 + e6ff16c commit 190b522e036f425fc834dafd712b94ddfa3dfc7f
@@ -31,7 +31,10 @@ def _get_partner_move_lines(self, account_type, date_from, target_move, period_l
res = []
total = []
cr = self.env.cr
company_ids = self.env.context.get('company_ids', (self.env.user.company_id.id,))
user_company = self.env.user.company_id
user_currency = user_company.currency_id
ResCurrency = self.env['res.currency'].with_context(date=date_from)
company_ids = self._context.get('company_ids') or [user_company.id]
move_state = ['draft', 'posted']
if target_move == 'posted':
move_state = ['posted']
@@ -88,15 +91,15 @@ def _get_partner_move_lines(self, account_type, date_from, target_move, period_l
partner_id = line.partner_id.id or False
if partner_id not in undue_amounts:
undue_amounts[partner_id] = 0.0
line_amount = line.balance
if line.balance == 0:
line_amount = ResCurrency._compute(line.company_id.currency_id, user_currency, line.balance)
if user_currency.is_zero(line_amount):
continue
for partial_line in line.matched_debit_ids:
if partial_line.create_date[:10] <= date_from:
line_amount += partial_line.amount
line_amount += ResCurrency._compute(partial_line.company_id.currency_id, user_currency, partial_line.amount)
for partial_line in line.matched_credit_ids:
if partial_line.create_date[:10] <= date_from:
line_amount -= partial_line.amount
line_amount -= ResCurrency._compute(partial_line.company_id.currency_id, user_currency, partial_line.amount)
if not self.env.user.company_id.currency_id.is_zero(line_amount):
undue_amounts[partner_id] += line_amount
lines[partner_id].append({
@@ -140,15 +143,15 @@ def _get_partner_move_lines(self, account_type, date_from, target_move, period_l
partner_id = line.partner_id.id or False
if partner_id not in partners_amount:
partners_amount[partner_id] = 0.0
line_amount = line.balance
if line.balance == 0:
line_amount = ResCurrency._compute(line.company_id.currency_id, user_currency, line.balance)
if user_currency.is_zero(line_amount):
continue
for partial_line in line.matched_debit_ids:
if partial_line.create_date[:10] <= date_from:
line_amount += partial_line.amount
line_amount += ResCurrency._compute(partial_line.company_id.currency_id, user_currency, partial_line.amount)
for partial_line in line.matched_credit_ids:
if partial_line.create_date[:10] <= date_from:
line_amount -= partial_line.amount
line_amount -= ResCurrency._compute(partial_line.company_id.currency_id, user_currency, partial_line.amount)
if not self.env.user.company_id.currency_id.is_zero(line_amount):
partners_amount[partner_id] += line_amount
@@ -28,18 +28,18 @@
<label for="account_asset_id" attrs="{'invisible': [('type','!=','purchase')]}"/>
<label for="account_asset_id" string="Deferred Revenue Account" attrs="{'invisible': [('type','!=','sale')]}"/>
</div>
<field name="account_asset_id" nolabel="1" attrs="{'invisible': [('type','=', False)]}"/>
<field name="account_asset_id" nolabel="1" attrs="{'invisible': [('type','=', False)]}" domain="[('company_id', '=', company_id)]"/>
<div>
<label for="account_depreciation_id" attrs="{'invisible': [('type','!=','purchase')]}"/>
<label for="account_depreciation_id" string="Recognition Income Account" attrs="{'invisible': [('type','!=','sale')]}"/>
</div>
<field name="account_depreciation_id" nolabel="1"/>
<field name="account_depreciation_id" nolabel="1" domain="[('company_id', '=', company_id)]"/>
<div>
<label for="account_depreciation_expense_id" attrs="{'invisible': [('type','!=','purchase')]}"/>
<label for="account_depreciation_expense_id" string="Recognition Account" attrs="{'invisible': [('type','!=','sale')]}"/>
</div>
<field name="account_depreciation_expense_id" nolabel="1"/>
<field name="account_analytic_id" groups="analytic.group_analytic_accounting"/>
<field name="account_depreciation_expense_id" nolabel="1" domain="[('company_id', '=', company_id)]"/>
<field name="account_analytic_id" domain="[('company_id', '=', company_id)]" groups="analytic.group_analytic_accounting"/>
</group>
<group string="Periodicity">
<field name="method_time" string="Time Method Based On" widget="radio" attrs="{'invisible': [('type','!=','purchase')]}"/>
@@ -33,7 +33,7 @@
<tbody>
<tr t-foreach="line['lines']" t-as="bom_line">
<td colspan="3">
<span t-att-res-id="bom_line['product_id'].id" res-model="product.product" view-type="form" t-esc="bom_line['product_id'].name"/>
<span t-att-res-id="bom_line['product_id'].id" res-model="product.product" view-type="form" t-esc="bom_line['product_id'].display_name"/>
</td>
<td class="text-right">
<span t-esc="bom_line['product_uom_qty']"/> <span t-esc="bom_line['product_uom'].name" groups="product.group_uom"/>
@@ -374,10 +374,11 @@ def action_invoice_create(self, grouped=False, final=False):
raise UserError(_('There is no invoicable line.'))
for invoice in invoices.values():
invoice.compute_taxes()
if not invoice.invoice_line_ids:
raise UserError(_('There is no invoicable line.'))
# If invoice is negative, do a refund invoice instead
if invoice.amount_untaxed < 0:
if invoice.amount_total < 0:
invoice.type = 'out_refund'
for line in invoice.invoice_line_ids:
line.quantity = -line.quantity
@@ -0,0 +1,11 @@
Spain, 2018-10-17
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,
Ugaitz Olaizola Arbelaitz uolaizola@binovo.es

0 comments on commit 190b522

Please sign in to comment.