Merge lp:~openerp-dev/openobject-addons/7.0-opw-593375-rgo into lp:openobject-addons/7.0

Proposed by Ravi Gohil (OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/7.0-opw-593375-rgo
Merge into: lp:openobject-addons/7.0
Diff against target: 118 lines (+45/-42)
1 file modified
sale/wizard/sale_make_invoice_advance.py (+45/-42)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/7.0-opw-593375-rgo
Reviewer Review Type Date Requested Status
Naresh(OpenERP) Pending
Review via email: mp+170745@code.launchpad.net

Description of the change

Hi,

Invoice created from Sales Orders with "Percentage" option does not have taxes in it. Currently, the invoice is created on total amount(tax included) of a sale order with given percentage and no tax information.

This branch will fix this issue by adding taxes from the order lines to invoice lines. Kindly review the fix.

Thanks.

To post a comment you must log in.
9258. By Thibault Delavallée (OpenERP)

[MERGE] [FIX] Various improvements in quick create in kanban view.

- [FIX] crm: fixed crash when searching leads/opportunities on section_id then trying to create a new lead/opportunity. The crash was due to a 'default_section_id: self' in the search_view, that is not supported in 7.0.
- [FIX] crm, task, issue, hr_applicant: fixed quick create in kanban view not taking into account the stage in which it is being created.
- [FIX] mail: when tracking modified values for automatic subscription, also take into account default values coming from the context
- [FIX] issue: added default responsible

9259. By Martin Trigaux (OpenERP)

[MERGE] [FIX] idea: remove filter on many2many field

9260. By Martin Trigaux (OpenERP)

[MERGE] [IMP] l10n_ca: Replaced french leftover tax names in l10n_ca's account_tax_en.xml.

Replaced TVH by HST and TVQ by QST
courtesy of Virgil Dupras

9261. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9262. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9263. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9264. By Xavier ALT

[MERGE] [FIX] l10n_be_invoice_bba: correctly create bba reference when creating an invoice

  When creating an invoice from another object (sale: invoice from sale order
  line, sale: invoice on delivery order, ...) we have to make sure that newly
  created invoice respect partner's default ``communication type``, and
  accordingly generate a new BBA if required and none provided.

9265. By Martin Trigaux (OpenERP)

[MERGE] [FIX] OPW 590066 account: remove accounting information lines from Journal items

9266. By Denis Ledoux (OpenERP)

[FIX]account: fix of sxw of account_print_invoice, which was using o.address_invoice_id.partner_id instead of o.partner_id

9267. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9268. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9269. By Martin Trigaux (OpenERP)

[FIX] point_of_sale: don't group move lines if debit and credit

9270. By Thibault Delavallée (OpenERP)

[FIX] project: removed old code that was messing with followers intorduced at revision 8435.

9271. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9272. By Martin Trigaux (OpenERP)

[MERGE] [FIX] l10n_ch: reStructuredText in description file, courtesy of Yannick Vaucher (Camptocamp)

9273. By Martin Trigaux (OpenERP)

[MERGE] [FIX] hr_timesheet_invoice: use invoice amount instead of product and product not mandatory

9274. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9275. By Christophe Simonis (OpenERP)

[FIX] crm: copy() of partners must return id of new partner

9276. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9277. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9278. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9279. By Martin Trigaux (OpenERP)

[FIX] hr_expense: fallback on domain if no analytic_account for line_ids

9280. By Olivier Dony (Odoo)

[FIX] procurement: background procurement scheduler should be working in batch mode, with one transaction per order

A programming error during an older refactoring lead to
the scheduler working with a single monolithic transaction.
This could cause unnecessary resource contention, plus
undesired rollback of all previous operations in the event
of an exception during scheduling.

9281. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9282. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9283. By Xavier (Open ERP)

[FIX] call this.print on end of ReceiptScreenWidget.show instead of explicit window.print

print method already existed, probably to allow overriding printing, but it was not actually called

9284. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9285. By Olivier Dony (Odoo)

[MERGE] l10n_pl: updated tax rates and tax definitions, courtesy of Tymoteusz Motylewski

9286. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9287. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9288. By van der Essen Frédéric (OpenERP)

[MERGE] point_of_sale: fixing bugs discovered during the opendays

9289. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9290. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9291. By Martin Trigaux (OpenERP)

[FIX] account_voucher: while canceling avoid removing twice the same reconciled move

9293. By Quentin (OpenERP) <email address hidden>

[FIX] account_anglo_saxon: backport of revision 8787 of trunk

9294. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9295. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9296. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9297. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9298. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9299. By Denis Ledoux (OpenERP)

[FIX]email_template: generate_email_for_composer, clean context before find or create partner, to avoid default values for partner

9300. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9301. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9302. By Christophe Simonis (OpenERP)

[FIX] base_report_designer: correct "Export To RML" on OSX

9303. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9304. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9305. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9306. By Martin Trigaux (OpenERP)

[FIX] document: apply security rules documented on doc/access_permissions.rst. (opw #592652)

9307. By Martin Trigaux (OpenERP)

[MERGE] l10n_ca: courtsey of Maxime Chambreuil (savoirfairelinux)

[FIX] Fiscal positions.
[IMP] Separate different rates of HST. Update taxes (BC is not harmonized, PE is).
[IMP] better module description

9308. By Martin Trigaux (OpenERP)

[MERGE] [IMP] report_webkit: better installation message for wkhtmltopdf, courtesy of Yannick Vaucher (Camptocamp)

9309. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9310. By Martin Trigaux (OpenERP)

[FIX] account_voucher: writeoff amount on unreconciled amount instead of price to allow negative writeoff (eg: negative currency change rate difference) (opw #593977)

9311. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9312. By Martin Trigaux (OpenERP)

[FIX] account_voucher: better voucher payment screen
revert commit 9310 with incorrect writeoff amount
hide writeoff reconcilation fields when no price difference
hide analytic_id (Write-Off Analytic Account) when not with_writeoff

9313. By Martin Trigaux (OpenERP)

[FIX] hr_timesheet_invoice: use product price on invoice even when not forcing

9314. By Martin Trigaux (OpenERP)

[FIX] account_invoice: due date is reset to current date when we have no payment term and due date is manually defined

9315. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9316. By Martin Trigaux (OpenERP)

[FIX] project_issue: reset kanban_state when changing the stage to be consistent with project_task

9317. By Martin Trigaux (OpenERP)

[FIX] hr_timesheet_invoice: better invoice price management
- if force product, use its sale price
- if on a journal of type 'general' (eg: expenses) and has a product, use its sale price
- else (eg: expenses) use the total amount on analytic lines

9318. By Martin Trigaux (OpenERP)

[FIX] stock: for a stock picking set date start and end date based on expected (date_exected) instead of creation date (date)

9319. By Martin Trigaux (OpenERP)

[IMP] mrp: properly remove product lines and workorder lines when confirming a manufacturing order, avoid getting traceback if trying action on deleted record

9320. By Ravi Gohil (OpenERP)

[FIX] sale: The advance invoice created from Sale Order with Percentage option do not have taxes in it. (Maintenance Case: 593375)

Unmerged revisions

9320. By Ravi Gohil (OpenERP)

[FIX] sale: The advance invoice created from Sale Order with Percentage option do not have taxes in it. (Maintenance Case: 593375)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'sale/wizard/sale_make_invoice_advance.py'
2--- sale/wizard/sale_make_invoice_advance.py 2013-02-12 07:01:36 +0000
3+++ sale/wizard/sale_make_invoice_advance.py 2013-07-26 06:00:45 +0000
4@@ -76,35 +76,38 @@
5 sale_ids = context.get('active_ids', [])
6
7 result = []
8+ inv_lines = []
9 for sale in sale_obj.browse(cr, uid, sale_ids, context=context):
10- val = inv_line_obj.product_id_change(cr, uid, [], wizard.product_id.id,
11- uom_id=False, partner_id=sale.partner_id.id, fposition_id=sale.fiscal_position.id)
12- res = val['value']
13-
14- # determine and check income account
15- if not wizard.product_id.id :
16- prop = ir_property_obj.get(cr, uid,
17- 'property_account_income_categ', 'product.category', context=context)
18- prop_id = prop and prop.id or False
19- account_id = fiscal_obj.map_account(cr, uid, sale.fiscal_position or False, prop_id)
20- if not account_id:
21- raise osv.except_osv(_('Configuration Error!'),
22- _('There is no income account defined as global property.'))
23- res['account_id'] = account_id
24- if not res.get('account_id'):
25- raise osv.except_osv(_('Configuration Error!'),
26- _('There is no income account defined for this product: "%s" (id:%d).') % \
27- (wizard.product_id.name, wizard.product_id.id,))
28-
29- # determine invoice amount
30 if wizard.amount <= 0.00:
31 raise osv.except_osv(_('Incorrect Data'),
32 _('The value of Advance Amount must be positive.'))
33 if wizard.advance_payment_method == 'percentage':
34- inv_amount = sale.amount_total * wizard.amount / 100
35- if not res.get('name'):
36- res['name'] = _("Advance of %s %%") % (wizard.amount)
37+ for line in sale.order_line:
38+ inv_line_vals = self.pool.get('sale.order.line')._prepare_order_line_invoice_line(cr, uid, line, False, context=context)
39+ inv_line_vals['price_unit'] = inv_line_vals['price_unit'] * wizard.amount / 100
40+ inv_line_vals['name'] += "\n(" + _("Advance of %s %%") % (wizard.amount) + ")"
41+ inv_lines.append((0, 0, inv_line_vals))
42 else:
43+ val = inv_line_obj.product_id_change(cr, uid, [], wizard.product_id.id,
44+ uom_id=False, partner_id=sale.partner_id.id, fposition_id=sale.fiscal_position.id)
45+ res = val['value']
46+
47+ # determine and check income account
48+ if not wizard.product_id.id :
49+ prop = ir_property_obj.get(cr, uid,
50+ 'property_account_income_categ', 'product.category', context=context)
51+ prop_id = prop and prop.id or False
52+ account_id = fiscal_obj.map_account(cr, uid, sale.fiscal_position or False, prop_id)
53+ if not account_id:
54+ raise osv.except_osv(_('Configuration Error!'),
55+ _('There is no income account defined as global property.'))
56+ res['account_id'] = account_id
57+ if not res.get('account_id'):
58+ raise osv.except_osv(_('Configuration Error!'),
59+ _('There is no income account defined for this product: "%s" (id:%d).') % \
60+ (wizard.product_id.name, wizard.product_id.id,))
61+
62+ # determine invoice amount
63 inv_amount = wizard.amount
64 if not res.get('name'):
65 #TODO: should find a way to call formatLang() from rml_parse
66@@ -114,25 +117,25 @@
67 else:
68 res['name'] = _("Advance of %s %s") % (symbol, inv_amount)
69
70- # determine taxes
71- if res.get('invoice_line_tax_id'):
72- res['invoice_line_tax_id'] = [(6, 0, res.get('invoice_line_tax_id'))]
73- else:
74- res['invoice_line_tax_id'] = False
75+ # determine taxes
76+ if res.get('invoice_line_tax_id'):
77+ res['invoice_line_tax_id'] = [(6, 0, res.get('invoice_line_tax_id'))]
78+ else:
79+ res['invoice_line_tax_id'] = False
80
81- # create the invoice
82- inv_line_values = {
83- 'name': res.get('name'),
84- 'origin': sale.name,
85- 'account_id': res['account_id'],
86- 'price_unit': inv_amount,
87- 'quantity': wizard.qtty or 1.0,
88- 'discount': False,
89- 'uos_id': res.get('uos_id', False),
90- 'product_id': wizard.product_id.id,
91- 'invoice_line_tax_id': res.get('invoice_line_tax_id'),
92- 'account_analytic_id': sale.project_id.id or False,
93- }
94+ # create the invoice
95+ inv_line_values = {
96+ 'name': res.get('name'),
97+ 'origin': sale.name,
98+ 'account_id': res['account_id'],
99+ 'price_unit': inv_amount,
100+ 'quantity': wizard.qtty or 1.0,
101+ 'discount': False,
102+ 'uos_id': res.get('uos_id', False),
103+ 'product_id': wizard.product_id.id,
104+ 'invoice_line_tax_id': res.get('invoice_line_tax_id'),
105+ 'account_analytic_id': sale.project_id.id or False,
106+ }
107 inv_values = {
108 'name': sale.client_order_ref or sale.name,
109 'origin': sale.name,
110@@ -140,7 +143,7 @@
111 'reference': False,
112 'account_id': sale.partner_id.property_account_receivable.id,
113 'partner_id': sale.partner_invoice_id.id,
114- 'invoice_line': [(0, 0, inv_line_values)],
115+ 'invoice_line': inv_lines or [(0, 0, inv_line_values)],
116 'currency_id': sale.pricelist_id.currency_id.id,
117 'comment': '',
118 'payment_term': sale.payment_term.id,