[tryton-debian-vcs] tryton-modules-account-invoice branch upstream updated. upstream/3.0.1-1-gc9344de
Mathias Behrle
tryton-debian-vcs at alioth.debian.org
Wed Mar 26 19:49:38 UTC 2014
The following commit has been merged in the upstream branch:
https://alioth.debian.org/plugins/scmgit/cgi-bin/gitweb.cgi/?p=tryton/tryton-modules-account-invoice.git;a=commitdiff;h=upstream/3.0.1-1-gc9344de
commit c9344decf1a81a6fddd88e5bf7e4f51cb4c31b4f
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Wed Mar 26 18:44:49 2014 +0100
Adding upstream version 3.0.2.
diff --git a/CHANGELOG b/CHANGELOG
index 11b7949..45083f3 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,6 @@
+Version 3.0.2 - 2014-03-22
+* Bug fixes (see mercurial logs for details)
+
Version 3.0.1 - 2014-01-18
* Bug fixes (see mercurial logs for details)
diff --git a/COPYRIGHT b/COPYRIGHT
index 5d422e0..77715d8 100644
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -1,6 +1,6 @@
-Copyright (C) 2008-2013 Cédric Krier.
+Copyright (C) 2008-2014 Cédric Krier.
Copyright (C) 2008-2013 Bertrand Chenal.
-Copyright (C) 2008-2013 B2CK SPRL.
+Copyright (C) 2008-2014 B2CK SPRL.
Copyright (C) 2004-2008 Tiny SPRL.
This program is free software: you can redistribute it and/or modify
diff --git a/PKG-INFO b/PKG-INFO
index 65fddb7..ef65c39 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: trytond_account_invoice
-Version: 3.0.1
+Version: 3.0.2
Summary: Tryton module for invoicing
Home-page: http://www.tryton.org/
Author: Tryton
diff --git a/account.py b/account.py
index 7212126..58ec2de 100644
--- a/account.py
+++ b/account.py
@@ -90,7 +90,7 @@ class FiscalYear:
('id', '!=', self.id),
])
if fiscalyears:
- self.raise_user_error('different_invoice_sequences', {
+ self.raise_user_error('different_invoice_sequence', {
'first': self.rec_name,
'second': fiscalyears[0].rec_name,
})
@@ -219,7 +219,7 @@ class Period:
for period in periods:
sequence = getattr(period, sequence_name)
if (sequence and
- sequence.id != vals[sequence]):
+ sequence.id != vals[sequence_name]):
if Invoice.search([
('invoice_date', '>=', period.start_date),
('invoice_date', '<=', period.end_date),
diff --git a/invoice.py b/invoice.py
index 8524e50..ce05309 100644
--- a/invoice.py
+++ b/invoice.py
@@ -6,7 +6,8 @@ import itertools
import operator
from sql import Literal
from sql.aggregate import Count, Sum
-from sql.conditionals import Coalesce
+from sql.conditionals import Coalesce, Case
+from sql.functions import Abs
from trytond.model import Workflow, ModelView, ModelSQL, fields
from trytond.report import Report
@@ -555,13 +556,15 @@ class Invoice(Workflow, ModelSQL, ModelView):
sum_ = Decimal(str(sum_))
tax_amount[invoice_id] = sum_
- invoices_move = []
- invoices_no_move = []
+ invoices_move = set()
+ invoices_no_move = set()
for invoice in invoices:
if invoice.move:
- invoices_move.append(invoice)
+ invoices_move.add(invoice.id)
else:
- invoices_no_move.append(invoice)
+ invoices_no_move.add(invoice.id)
+ invoices_move = cls.browse(invoices_move)
+ invoices_no_move = cls.browse(invoices_no_move)
type_name = cls.total_amount._field.sql_type().base
invoice = cls.__table__()
@@ -574,7 +577,13 @@ class Invoice(Workflow, ModelSQL, ModelView):
condition=invoice.move == move.id
).join(line, condition=move.id == line.move
).select(invoice.id,
- Coalesce(Sum(line.debit - line.credit), 0).cast(type_name),
+ Coalesce(Sum(
+ Case((line.second_currency == invoice.currency,
+ Abs(line.amount_second_currency)
+ * Abs(line.debit - line.credit)
+ / (line.debit - line.credit)),
+ else_=line.debit - line.credit)),
+ 0).cast(type_name),
where=(invoice.account == line.account) & red_sql,
group_by=invoice.id))
for invoice_id, sum_ in cursor.fetchall():
@@ -917,10 +926,10 @@ class Invoice(Workflow, ModelSQL, ModelView):
term_lines = [(Date.today(), total)]
for date, amount in term_lines:
val = self._get_move_line(date, amount)
- remainder_total_currency -= val['amount_second_currency']
+ remainder_total_currency += val['amount_second_currency']
move_lines.append(val)
if not self.currency.is_zero(remainder_total_currency):
- move_lines[-1]['amount_second_currency'] += \
+ move_lines[-1]['amount_second_currency'] -= \
remainder_total_currency
accounting_date = self.accounting_date or self.invoice_date
@@ -1504,7 +1513,7 @@ class InvoiceLine(ModelSQL, ModelView):
on_change=['product', 'unit', 'quantity', 'description',
'_parent_invoice.type', '_parent_invoice.party',
'_parent_invoice.currency', '_parent_invoice.currency_date',
- 'party', 'currency', 'invoice'],
+ 'party', 'currency', 'invoice', 'invoice_type'],
depends=['type'])
product_uom_category = fields.Function(
fields.Many2One('product.uom.category', 'Product Uom Category',
@@ -1923,6 +1932,14 @@ class InvoiceLine(ModelSQL, ModelView):
return super(InvoiceLine, cls).create(vlist)
@classmethod
+ def copy(cls, lines, default=None):
+ if default is None:
+ default = {}
+ default = default.copy()
+ default.setdefault('origin', None)
+ return super(InvoiceLine, cls).copy(lines, default=default)
+
+ @classmethod
def validate(cls, lines):
super(InvoiceLine, cls).validate(lines)
for line in lines:
@@ -2498,7 +2515,7 @@ class PayInvoiceAsk(ModelView):
lines = fields.Many2Many('account.move.line', None, None, 'Lines',
domain=[
('id', 'in', Eval('lines_to_pay')),
- ('reconciliation', '=', False),
+ ('reconciliation', '=', None),
],
states={
'invisible': Eval('type') != 'writeoff',
@@ -2560,6 +2577,11 @@ class PayInvoice(Wizard):
'amount to pay.'),
})
+ def get_reconcile_lines_for_amount(self, invoice, amount):
+ if invoice.type in ('in_invoice', 'out_credit_note'):
+ amount = -amount
+ return invoice.get_reconcile_lines_for_amount(amount)
+
def default_start(self, fields):
Invoice = Pool().get('account.invoice')
default = {}
@@ -2581,7 +2603,7 @@ class PayInvoice(Wizard):
with Transaction().set_context(date=self.start.date):
amount = Currency.compute(self.start.currency,
self.start.amount, invoice.company.currency)
- _, remainder = invoice.get_reconcile_lines_for_amount(amount)
+ _, remainder = self.get_reconcile_lines_for_amount(invoice, amount)
if remainder == Decimal('0.0') and amount <= invoice.amount_to_pay:
return 'pay'
return 'ask'
@@ -2609,7 +2631,7 @@ class PayInvoice(Wizard):
if invoice.company.currency.is_zero(amount):
lines = invoice.lines_to_pay
else:
- lines, _ = invoice.get_reconcile_lines_for_amount(amount)
+ lines, _ = self.get_reconcile_lines_for_amount(invoice, amount)
default['lines'] = [x.id for x in lines]
for line_id in default['lines'][:]:
@@ -2650,7 +2672,7 @@ class PayInvoice(Wizard):
self.start.amount, invoice.company.currency)
reconcile_lines, remainder = \
- invoice.get_reconcile_lines_for_amount(amount)
+ self.get_reconcile_lines_for_amount(invoice, amount)
amount_second_currency = None
second_currency = None
diff --git a/tryton.cfg b/tryton.cfg
index 7439199..b2775b6 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -1,5 +1,5 @@
[tryton]
-version=3.0.1
+version=3.0.2
depends:
account
account_product
diff --git a/trytond_account_invoice.egg-info/PKG-INFO b/trytond_account_invoice.egg-info/PKG-INFO
index 772008c..b0908fd 100644
--- a/trytond_account_invoice.egg-info/PKG-INFO
+++ b/trytond_account_invoice.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: trytond-account-invoice
-Version: 3.0.1
+Version: 3.0.2
Summary: Tryton module for invoicing
Home-page: http://www.tryton.org/
Author: Tryton
--
tryton-modules-account-invoice
More information about the tryton-debian-vcs
mailing list