clearcorp team mailing list archive
-
clearcorp team
-
Mailing list archive
-
Message #00188
lp:~rr.clearcorp/openerp-ccorp-addons/6.1-account_multicompany_relation_feature into lp:openerp-ccorp-addons
Ronald Rubi has proposed merging lp:~rr.clearcorp/openerp-ccorp-addons/6.1-account_multicompany_relation_feature into lp:openerp-ccorp-addons.
Requested reviews:
CLEARCORP drivers (clearcorp-drivers)
For more details, see:
https://code.launchpad.net/~rr.clearcorp/openerp-ccorp-addons/6.1-account_multicompany_relation_feature/+merge/112474
[FIX] Fix module multicompany relation
--
https://code.launchpad.net/~rr.clearcorp/openerp-ccorp-addons/6.1-account_multicompany_relation_feature/+merge/112474
Your team CLEARCORP development team is subscribed to branch lp:openerp-ccorp-addons.
=== modified file '.bzrignore' (properties changed: -x to +x)
=== modified file 'LICENSE' (properties changed: -x to +x)
=== modified file 'TODO-6.1/account_analytic_plans_fix/__init__.py' (properties changed: -x to +x)
=== modified file 'TODO-6.1/account_analytic_plans_fix/__openerp__.py' (properties changed: -x to +x)
=== modified file 'TODO-6.1/account_analytic_plans_fix/account_analytic_plans_fix.py' (properties changed: -x to +x)
=== modified file 'TODO-6.1/account_analytic_rename/account_analytic_rename.py' (properties changed: -x to +x)
=== modified file 'TODO-6.1/account_asset_product/account_asset_produt.py' (properties changed: -x to +x)
=== modified file 'TODO-6.1/account_asset_product/account_asset_produt_sequence.xml' (properties changed: -x to +x)
=== modified file 'TODO-6.1/account_company_shortcut/account_company_shortcut_rename.py' (properties changed: -x to +x)
=== modified file 'TODO-6.1/account_journal_template/__init__.py' (properties changed: -x to +x)
=== modified file 'TODO-6.1/account_journal_template/__openerp__.py' (properties changed: -x to +x)
=== modified file 'TODO-6.1/account_journal_template/account_journal_template.py' (properties changed: -x to +x)
=== modified file 'TODO-6.1/account_journal_template/account_journal_template_data.xml' (properties changed: -x to +x)
=== modified file 'TODO-6.1/account_period_extended_code/__init__.py' (properties changed: -x to +x)
=== modified file 'TODO-6.1/account_period_extended_code/__openerp__.py' (properties changed: -x to +x)
=== modified file 'TODO-6.1/account_period_extended_code/account_period_extended_code.py' (properties changed: -x to +x)
=== modified file 'TODO-6.1/address_name_inc/address_name_inc.py' (properties changed: -x to +x)
=== modified file 'TODO-6.1/ccorp_account/__init__.py' (properties changed: -x to +x)
=== modified file 'TODO-6.1/ccorp_account/__terp__.py' (properties changed: -x to +x)
=== modified file 'TODO-6.1/ccorp_account/ccorp_account.py' (properties changed: -x to +x)
=== modified file 'TODO-6.1/ccorp_account/ccorp_account_demo.xml' (properties changed: -x to +x)
=== modified file 'TODO-6.1/ccorp_account/ccorp_account_report.xml' (properties changed: -x to +x)
=== modified file 'TODO-6.1/ccorp_account/ccorp_account_view.xml' (properties changed: -x to +x)
=== modified file 'TODO-6.1/ccorp_account/ccorp_account_webkit_report.xml' (properties changed: -x to +x)
=== modified file 'TODO-6.1/ccorp_account/i18n/ccorp_account.pot' (properties changed: -x to +x)
=== modified file 'TODO-6.1/ccorp_account/i18n/ccorp_account_webkit.pot' (properties changed: -x to +x)
=== modified file 'TODO-6.1/ccorp_account/i18n/es.po' (properties changed: -x to +x)
=== modified file 'TODO-6.1/ccorp_account/i18n/es_CR.po' (properties changed: -x to +x)
=== modified file 'TODO-6.1/ccorp_account/report/__init__.py' (properties changed: -x to +x)
=== modified file 'TODO-6.1/ccorp_account/report/invoice.mako' (properties changed: -x to +x)
=== modified file 'TODO-6.1/ccorp_account/report/invoice.py' (properties changed: -x to +x)
=== modified file 'TODO-6.1/ccorp_account/report/invoice.rml' (properties changed: -x to +x)
=== modified file 'TODO-6.1/ccorp_account_payment_term/ccorp_account_payment_term.py' (properties changed: -x to +x)
=== modified file 'TODO-6.1/ccorp_main_company/__init__.py' (properties changed: -x to +x)
=== modified file 'TODO-6.1/ccorp_main_company/__openerp__.py' (properties changed: -x to +x)
=== modified file 'TODO-6.1/ccorp_main_company/ccorp_main_company_data.xml' (properties changed: -x to +x)
=== modified file 'TODO-6.1/ccorp_partner_payment_term/ccorp_partner_payment_term.py' (properties changed: -x to +x)
=== modified file 'TODO-6.1/ccorp_purchase/__init__.py' (properties changed: -x to +x)
=== modified file 'TODO-6.1/ccorp_purchase/__terp__.py' (properties changed: -x to +x)
=== modified file 'TODO-6.1/ccorp_purchase/ccorp_purchase.py' (properties changed: -x to +x)
=== modified file 'TODO-6.1/ccorp_purchase/ccorp_purchase_quotation_webkit_report.xml' (properties changed: -x to +x)
=== modified file 'TODO-6.1/ccorp_purchase/ccorp_purchase_webkit_report.xml' (properties changed: -x to +x)
=== modified file 'TODO-6.1/ccorp_purchase/i18n/ccorp_purchase_webkit.pot' (properties changed: -x to +x)
=== modified file 'TODO-6.1/ccorp_purchase/i18n/es_CR.po' (properties changed: -x to +x)
=== modified file 'TODO-6.1/ccorp_purchase/report/__init__.py' (properties changed: -x to +x)
=== modified file 'TODO-6.1/ccorp_purchase/report/purchase_order.mako' (properties changed: -x to +x)
=== modified file 'TODO-6.1/ccorp_purchase/report/purchase_order.py' (properties changed: -x to +x)
=== modified file 'TODO-6.1/ccorp_purchase/report/purchase_quotation.mako' (properties changed: -x to +x)
=== modified file 'TODO-6.1/ccorp_purchase/report/purchase_quotation.py' (properties changed: -x to +x)
=== modified file 'TODO-6.1/ccorp_report_fonts/__init__.py' (properties changed: -x to +x)
=== modified file 'TODO-6.1/ccorp_report_fonts/__terp__.py' (properties changed: -x to +x)
=== modified file 'TODO-6.1/ccorp_report_fonts/ccorp_report_fonts.py' (properties changed: -x to +x)
=== modified file 'TODO-6.1/ccorp_sale_payment_term/ccorp_sale_payment_term.py' (properties changed: -x to +x)
=== modified file 'TODO-6.1/company_webkit/company_webkit.py' (properties changed: -x to +x)
=== modified file 'TODO-6.1/purchase_change_pricelist/wizard/__init__.py' (properties changed: -x to +x)
=== modified file 'TODO-6.1/purchase_change_pricelist/wizard/purchase_change_pricelist.py' (properties changed: -x to +x)
=== modified file 'TODO-6.1/purchase_change_pricelist/wizard/purchase_change_pricelist_view.xml' (properties changed: -x to +x)
=== modified file 'TODO-6.1/report_webkit_format/__init__.py' (properties changed: -x to +x)
=== modified file 'TODO-6.1/report_webkit_format/__openerp__.py' (properties changed: -x to +x)
=== modified file 'TODO-6.1/report_webkit_format/report_webkit_format.py' (properties changed: -x to +x)
=== modified file 'TODO-6.1/sale_change_pricelist/wizard/__init__.py' (properties changed: -x to +x)
=== modified file 'TODO-6.1/sale_change_pricelist/wizard/sale_change_pricelist.py' (properties changed: -x to +x)
=== modified file 'TODO-6.1/sale_change_pricelist/wizard/sale_change_pricelist_view.xml' (properties changed: -x to +x)
=== modified file 'TODO-6.1/stock_location_rename/stock_location_rename.py' (properties changed: -x to +x)
=== modified file 'account_account_rename/account_rename.py' (properties changed: -x to +x)
=== modified file 'account_invoice_global_discount/__init__.py' (properties changed: -x to +x)
=== modified file 'account_invoice_global_discount/__openerp__.py' (properties changed: -x to +x)
=== modified file 'account_invoice_global_discount/account_invoice_global_discount.py' (properties changed: -x to +x)
=== modified file 'account_invoice_global_discount/account_invoice_global_discount_view.xml' (properties changed: -x to +x)
=== modified file 'account_invoice_global_discount/account_invoice_global_discount_wizard.xml' (properties changed: -x to +x)
=== modified file 'account_invoice_global_discount/i18n/account_invoice_global_discount.pot' (properties changed: -x to +x)
=== modified file 'account_invoice_global_discount/i18n/ar.po' (properties changed: -x to +x)
=== modified file 'account_invoice_global_discount/i18n/es.po' (properties changed: -x to +x)
=== modified file 'account_invoice_global_discount/i18n/es_ES.po' (properties changed: -x to +x)
=== modified file 'account_invoice_global_discount/wizard/__init__.py' (properties changed: -x to +x)
=== modified file 'account_invoice_global_discount/wizard/discount_wizard.py' (properties changed: -x to +x)
=== modified file 'account_invoice_webkit_report/__init__.py' (properties changed: -x to +x)
=== modified file 'account_invoice_webkit_report/__openerp__.py' (properties changed: -x to +x)
=== modified file 'account_invoice_webkit_report/ccorp_account_webkit_report.xml' (properties changed: -x to +x)
=== modified file 'account_invoice_webkit_report/i18n/ccorp_account.pot' (properties changed: -x to +x)
=== modified file 'account_invoice_webkit_report/i18n/ccorp_account_webkit.pot' (properties changed: -x to +x)
=== modified file 'account_invoice_webkit_report/i18n/es.po' (properties changed: -x to +x)
=== modified file 'account_invoice_webkit_report/i18n/es_CR.po' (properties changed: -x to +x)
=== modified file 'account_invoice_webkit_report/report/__init__.py' (properties changed: -x to +x)
=== modified file 'account_invoice_webkit_report/report/invoice.mako' (properties changed: -x to +x)
=== modified file 'account_invoice_webkit_report/report/invoice.py' (properties changed: -x to +x)
=== modified file 'account_journal_extended_code/__init__.py' (properties changed: -x to +x)
=== modified file 'account_journal_extended_code/__openerp__.py' (properties changed: -x to +x)
=== modified file 'account_journal_extended_code/account_journal_extended_code.py' (properties changed: -x to +x)
=== modified file 'account_journal_view_extended/__init__.py' (properties changed: -x to +x)
=== modified file 'account_journal_view_extended/__openerp__.py' (properties changed: -x to +x)
=== modified file 'account_journal_view_extended/account_journal_view_extended_view.xml' (properties changed: -x to +x)
=== modified file 'account_multicompany_relation/__init__.py' (properties changed: -x to +x)
=== modified file 'account_multicompany_relation/__openerp__.py' (properties changed: -x to +x)
=== modified file 'account_multicompany_relation/account_multicompany_relation.py' (properties changed: -x to +x)
--- account_multicompany_relation/account_multicompany_relation.py 2011-12-20 00:30:44 +0000
+++ account_multicompany_relation/account_multicompany_relation.py 2012-06-28 02:18:19 +0000
@@ -19,30 +19,131 @@
##############################################################################
from osv import osv, fields
+from copy import copy
class account_multicompany_relation(osv.osv):
- _name = "account.multicompany.relation"
- _columns = {
- 'name' : fields.char('Name',size=64, required=True,help='Name for the mirror object relation'),
- 'origin_account' : fields.many2one('account.account', 'Original Account',help='Indicate the original account where the transaction is taking place'),
- 'targ_account' : fields.many2one('account.account', 'Target Account',help='Indicate the target account where the transaction of the original account has to be seen, this is an account from another company'),
- 'origin_journal' : fields.many2one('account.journal', 'Original Journal',help='Indicate the original journal where the transaction is taking place'),
- 'targ_journal' : fields.many2one('account.journal', 'Target Journal',help='Indicate the original account where the transaction is taking place'),
- }
+ _name = "account.multicompany.relation"
+ _columns = {
+ 'name' : fields.char('Name',size=64, required=True,help='Name for the mirror object relation'),
+ 'origin_account' : fields.many2one('account.account', 'Original Account',help='Indicate the original account where the transaction is taking place'),
+ 'targ_account' : fields.many2one('account.account', 'Target Account',help='Indicate the target account where the transaction of the original account has to be seen, this is an account from another company'),
+ 'origin_journal' : fields.many2one('account.journal', 'Original Journal',help='Indicate the original journal where the transaction is taking place'),
+ 'targ_journal' : fields.many2one('account.journal', 'Target Journal',help='Indicate the original account where the transaction is taking place'),
+ }
account_multicompany_relation()
class account_journal(osv.osv):
- _name = 'account.journal'
- _inherit = 'account.journal'
- _columns = {
- 'journal_mirror' : fields.many2one('account.multicompany.relation','Mirror Relation'),
- }
+ _name = 'account.journal'
+ _inherit = 'account.journal'
+ _columns = {
+ 'journal_mirror' : fields.many2one('account.multicompany.relation','Mirror Relation'),
+ }
account_journal()
class account_account(osv.osv):
- _name = 'account.account'
- _inherit = 'account.account'
- _columns = {
- 'account_mirror' : fields.many2one('account.multicompany.relation','Mirror Relation'),
- }
+ _name = 'account.account'
+ _inherit = 'account.account'
+ _columns = {
+ 'account_mirror' : fields.many2one('account.multicompany.relation','Mirror Relation'),
+ }
account_account()
+
+class account_voucher_journal_payment(osv.osv):
+ _name = 'account.voucher'
+ _inherit = 'account.voucher'
+ _description = 'Accounting Voucher'
+
+ def proforma_voucher(self, cr, uid, ids, context=None):
+ result = super(account_voucher_journal_payment, self).action_move_line_create(cr, uid, ids, context=context)
+ voucher = self.browse(cr,1,ids,context=context)[0]
+ if voucher.journal_id.journal_mirror:
+ mirror_journal = voucher.journal_id.journal_mirror
+
+ origin_journal = mirror_journal.origin_journal
+ origin_account = mirror_journal.origin_account
+ targ_journal = mirror_journal.targ_journal
+ targ_account = mirror_journal.targ_account
+
+ if voucher.move_id:
+ original_move = voucher.move_id
+
+ if original_move.line_id:
+ list_ = []
+ lines = original_move.line_id
+ for line in lines:
+ if line.account_id and line.account_id.id == origin_account.id:
+ list_.append(line)
+
+ if len(list_) == 1:
+ #Set period for target move with the correct company
+ if context == None:
+ context_copy = {'company_id': targ_account.company_id.id}
+ else:
+ context_copy = copy(context)
+ context_copy.update({'company_id': targ_account.company_id.id})
+ periods = self.pool.get('account.period').find(cr, 1, dt=original_move.date, context=context_copy)
+ if periods:
+ move_period = periods[0]
+
+ move = {
+ 'name':'auto: ' + original_move.name,
+ 'ref':original_move.ref,
+ 'journal_id':targ_journal.id,
+ 'period_id':move_period or False,
+ 'to_check':False,
+ 'partner_id':original_move.partner_id.id,
+ 'date':original_move.date,
+ 'narration':original_move.narration,
+ 'company_id':targ_account.company_id.id,
+ }
+ move_id = self.pool.get('account.move').create(cr, 1, move)
+
+ move_line_original = list_[0]
+
+ move_line_one = {
+ 'name':move_line_original.name,
+ 'debit':move_line_original.credit,
+ 'credit':move_line_original.debit,
+ 'account_id':targ_account.id,
+ 'move_id': move_id,
+ 'amount_currency':move_line_original.amount_currency * -1,
+ 'period_id':move_period or False,
+ 'journal_id':targ_journal.id,
+ 'partner_id':move_line_original.partner_id.id,
+ 'currency_id':move_line_original.currency_id.id,
+ 'date_maturity':move_line_original.date_maturity,
+ 'date':move_line_original.date,
+ 'date_created':move_line_original.date_created,
+ 'state':'valid',
+ 'company_id':targ_account.company_id.id,
+ }
+
+ self.pool.get('account.move.line').create(cr, 1, move_line_one)
+ if move_line_original.debit != 0.0:
+ move_line_two_account_id = targ_journal.default_credit_account_id
+ else:
+ move_line_two_account_id = targ_journal.default_debit_account_id
+
+ move_line_two = {
+ 'name':move_line_original.name,
+ 'debit':move_line_original.debit,
+ 'credit':move_line_original.credit,
+ 'account_id':move_line_two_account_id.id,
+ 'move_id': move_id,
+ 'amount_currency':move_line_original.amount_currency,
+ 'journal_id':targ_journal.id,
+ 'period_id':move_period or False,
+ 'partner_id':move_line_original.partner_id.id,
+ 'currency_id':move_line_original.currency_id.id,
+ 'date_maturity':move_line_original.date_maturity,
+ 'date':move_line_original.date,
+ 'date_created':move_line_original.date_created,
+ 'state':'valid',
+ 'company_id':targ_account.company_id.id,
+ }
+
+ self.pool.get('account.move.line').create(cr, 1, move_line_two)
+ self.pool.get('account.move').post(cr, 1, [move_id], context={})
+ return result
+
+account_voucher_journal_payment()
=== modified file 'account_multicompany_relation/account_multicompany_relation.xml' (properties changed: -x to +x)
=== modified file 'account_template_chart_name/account_template_chart_name.py' (properties changed: -x to +x)
=== modified file 'account_voucher_payment_method/__init__.py' (properties changed: -x to +x)
=== modified file 'account_voucher_payment_method/__openerp__.py' (properties changed: -x to +x)
--- account_voucher_payment_method/__openerp__.py 2011-12-20 03:05:02 +0000
+++ account_voucher_payment_method/__openerp__.py 2012-06-28 02:18:19 +0000
@@ -5,7 +5,6 @@
"depends" : ["account_voucher"],
"init_xml" : [],
"update_xml" : [
- "account_voucher_payment_workflow.xml",
"account_voucher_payment_method.xml",
],
"category" : "",
=== modified file 'account_voucher_payment_method/account_voucher_payment_method.py' (properties changed: -x to +x)
--- account_voucher_payment_method/account_voucher_payment_method.py 2012-05-04 19:37:32 +0000
+++ account_voucher_payment_method/account_voucher_payment_method.py 2012-06-28 02:18:19 +0000
@@ -200,221 +200,4 @@
##debug(default)
#return default
- def proforma_voucher_mirror(self, cr, uid, ids, context=None):
- super(account_voucher_journal_payment, self).action_move_line_create(cr, uid, ids, context=context)
- voucher = self.browse(cr,1,ids,context=context)[0]
- if voucher.journal_id.journal_mirror:
- mirror_journal = voucher.journal_id.journal_mirror
- targ_journal = mirror_journal.targ_journal
- targ_account = mirror_journal.targ_account
- company_id = self.pool.get('res.company').browse(cr,1,1)
- partner_id = company_id.partner_id
-
- period_id = self.pool.get('account.period').search(cr,1,['|',('date_start','=',voucher.period_id.date_start), ('date_stop','=',voucher.period_id.date_stop),('company_id','=',company_id.id)])[0]
-
- period = self.pool.get('account.period').browse(cr,1,period_id)
- args = {
- 'journal' : targ_journal,
- 'account' : targ_account,
- 'partner' : partner_id,
- 'period' : period,
- }
- self.action_move_line_create_mirror(cr,1,ids,args,context=context)
- return True
-
- def action_move_line_create_mirror(self, cr, uid, ids,args, context=None):
- def _get_payment_term_lines(term_id, amount):
- term_pool = self.pool.get('account.payment.term')
- if term_id and amount:
- terms = term_pool.compute(cr, uid, term_id, amount)
- return terms
- return False
- if context is None:
- context = {}
- move_pool = self.pool.get('account.move')
- move_line_pool = self.pool.get('account.move.line')
- currency_pool = self.pool.get('res.currency')
- tax_obj = self.pool.get('account.tax')
- seq_obj = self.pool.get('ir.sequence')
-
- for inv in self.browse(cr, uid, ids, context=context):
- #debug("DENTRO DEL FOR")
- mirror_journal_id = args.get('journal',False)
- mirror_account_id = args.get('account',False)
- period_id = args.get('period',False)
- partner_id = args.get('partner',False)
-
- #if inv.move_id:
- # continue
- context_multi_currency = context.copy()
- context_multi_currency.update({'date': inv.date})
-
- if inv.number:
- name = inv.number
- elif mirror_journal_id.sequence_id:
- name = seq_obj.get_id(cr, uid, mirror_journal_id.sequence_id.id)
- else:
- raise osv.except_osv(_('Error !'), _('Please define a sequence on the journal !'))
- if not inv.reference:
- ref = name.replace('/','')
- else:
- ref = inv.reference
-
- move = {
- 'name': name,
- 'journal_id': mirror_journal_id and mirror_journal_id.id or inv.journal_id.id,
- 'narration': inv.narration,
- 'date': inv.date,
- 'ref': ref,
- 'period_id': period_id and period_id.id or (inv.period_id and inv.period_id.id or False)
- }
- move_id = move_pool.create(cr, uid, move)
-
- #create the first line manually
- company_currency = mirror_journal_id and mirror_journal_id.company_id.currency_id.id or inv.journal_id.company_id.currency_id.id
- current_currency = mirror_journal_id and mirror_journal_id.currency.id or inv.currency_id.id
- debit = 0.0
- credit = 0.0
- # TODO: is there any other alternative then the voucher type ??
- # -for sale, purchase we have but for the payment and receipt we do not have as based on the bank/cash journal we can not know its payment or receipt
- if inv.type in ('purchase', 'payment'):
- credit = currency_pool.compute(cr, uid, current_currency, company_currency, inv.amount, context=context_multi_currency)
- elif inv.type in ('sale', 'receipt'):
- debit = currency_pool.compute(cr, uid, current_currency, company_currency, inv.amount, context=context_multi_currency)
- if debit < 0:
- credit = -debit
- debit = 0.0
- if credit < 0:
- debit = -credit
- credit = 0.0
- sign = debit - credit < 0 and -1 or 1
-
- #create the first line of the voucher
- move_line = {
- 'name': inv.name or '/',
- 'debit': debit,
- 'credit': credit,
- #'account_id': mirror_account_id and mirror_account_id.id or inv.account_id.id,
- 'account_id': mirror_journal_id and mirror_journal_id.default_debit_account_id.id or inv.account_id.id,
- 'move_id': move_id,
- 'journal_id': mirror_journal_id and mirror_journal_id.id or inv.journal_id.id,
- 'period_id': period_id and period_id.id or inv.period_id.id,
- 'partner_id': partner_id and partner_id.id or inv.partner_id.id,
- 'currency_id': company_currency <> current_currency and current_currency or False,
- 'amount_currency': company_currency <> current_currency and sign * inv.amount or 0.0,
- 'date': inv.date,
- 'date_maturity': inv.date_due
- }
- #debug(move_line)
- move_line_id = move_line_pool.create(cr, uid, move_line)
- rec_list_ids = []
- line_total = debit - credit
- #debug(line_total)
- if inv.type == 'sale':
- line_total = line_total - currency_pool.compute(cr, uid, inv.currency_id.id, company_currency, inv.tax_amount, context=context_multi_currency)
- elif inv.type == 'purchase':
- line_total = line_total + currency_pool.compute(cr, uid, inv.currency_id.id, company_currency, inv.tax_amount, context=context_multi_currency)
-
- #debug(inv.line_ids)
- #debug(line_total)
- for line in inv.line_ids:
- #debug("for de los lines")
- #debug(line.amount)
- #debug(line.amount_unreconciled)
- #debug(line.untax_amount)
- #debug("for de los lines")
- #create one move line per voucher line where amount is not 0.0
- if not line.amount:
- continue
- #we check if the voucher line is fully paid or not and create a move line to balance the payment and initial invoice if needed
- if line.amount == line.amount_unreconciled:
- amount = line.amount #residual amount in company currency
- else:
- amount = currency_pool.compute(cr, uid, current_currency, company_currency, line.amount or line.untax_amount, context=context_multi_currency)
-
- move_line = {
- 'journal_id': mirror_journal_id and mirror_journal_id.id or inv.journal_id.id,
- 'period_id': period_id and period_id.id or inv.period_id.id,
- 'name': line.name and line.name or '/',
- 'account_id': mirror_account_id and mirror_account_id.id or line.account_id.id,
- 'move_id': move_id,
- 'partner_id': partner_id and partner_id.id or inv.partner_id.id,
- 'currency_id': company_currency <> current_currency and current_currency or False,
- 'analytic_account_id': line.account_analytic_id and line.account_analytic_id.id or False,
- 'quantity': 1,
- 'credit': 0.0,
- 'debit': 0.0,
- 'date': inv.date
- }
- #debug(line.amount)
- #debug(amount)
- debug(line.move_line_id.amount_residual)
- if amount < 0:
- amount = -amount
- if line.type == 'dr':
- line.type = 'cr'
- else:
- line.type = 'dr'
-
- if (line.type=='dr'):
- #debug("DEBITO")
- #debug(line_total)
- #debug(amount)
- line_total += amount
- move_line['debit'] = amount
- move_line['account_id'] = mirror_journal_id.default_debit_account_id.id
- else:
- #debug("CREDITO")
- #debug(line_total)
- #debug(amount)
- line_total -= amount
- move_line['credit'] = amount
- move_line['account_id'] = mirror_account_id.id
-
- #if inv.tax_id and inv.type in ('sale', 'purchase'):
- # move_line.update({
- # 'account_tax_id': inv.tax_id.id,
- # })
- #if move_line.get('account_tax_id', False):
- # tax_data = tax_obj.browse(cr, uid, [move_line['account_tax_id']], context=context)[0]
- # if not (tax_data.base_code_id and tax_data.tax_code_id):
- # raise osv.except_osv(_('No Account Base Code and Account Tax Code!'),_("You have to configure account base code and account tax code on the '%s' tax!") % (tax_data.name))
- #sign = (move_line['debit'] - move_line['credit']) < 0 and -1 or 1
- #debug(move_line)
- #debug(line.type)
- move_line['amount_currency'] = company_currency <> current_currency and sign * line.amount or 0.0
- if move_line['debit'] == 0 and move_line['credit'] == 0:
- continue
- voucher_line = move_line_pool.create(cr, uid, move_line)
- #if line.move_line_id.id:
- # rec_ids = [voucher_line, line.move_line_id.id]
- # rec_list_ids.append(rec_ids)
-
- #VER QUE HACER CON LAS DE AJUSTE
- inv_currency_id = self.pool.get('res.currency').browse(cr,uid,current_currency) or mirror_journal_id.currency or mirror_journal_id.company_id.currency_id
- if not currency_pool.is_zero(cr, uid, inv_currency_id, line_total):
- diff = line_total
- account_id = False
- if inv.payment_option == 'with_writeoff':
- account_id = mirror_account_id and mirror_account_id.id or inv.writeoff_acc_id.id
- elif inv.type in ('sale', 'receipt'):
- account_id = mirror_account_id and mirror_account_id.id or (partner_id and partner_id.property_account_receivable.id or inv.partner_id.property_account_receivable.id)
- else:
- account_id = mirror_account_id and mirror_account_id.id or (partner_id and partner_id.property_account_payable.id or inv.partner_id.property_account_payable.id)
- move_line = {
- 'name': name,
- 'account_id': account_id,
- 'move_id': move_id,
- 'partner_id': partner_id and partner_id.id or inv.partner_id.id,
- 'date': inv.date,
- 'credit': diff > 0 and diff or 0.0,
- 'debit': diff < 0 and -diff or 0.0,
- #'amount_currency': company_currency <> current_currency and currency_pool.compute(cr, uid, company_currency, current_currency, diff * -1, context=context_multi_currency) or 0.0,
- #'currency_id': company_currency <> current_currency and current_currency or False,
- }
- #debug(move_line)
- move_line_pool.create(cr, uid, move_line)
- #debug("LLEGO AL POST")
- move_pool.post(cr, uid, [move_id], context={})
- return True
account_voucher_journal_payment()
=== modified file 'account_voucher_payment_method/account_voucher_payment_method.xml' (properties changed: -x to +x)
=== removed file 'account_voucher_payment_method/account_voucher_payment_workflow.xml'
--- account_voucher_payment_method/account_voucher_payment_workflow.xml 2011-12-20 03:03:16 +0000
+++ account_voucher_payment_method/account_voucher_payment_workflow.xml 1970-01-01 00:00:00 +0000
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding = "UTF-8"?>
-<openerp>
- <data>
- <record model = "workflow.activity" id = "account_voucher.act_done">
- <field name="action">proforma_voucher_mirror()</field>
- </record>
- </data>
-</openerp>
-
-
-
=== modified file 'base_company_prefix/__init__.py' (properties changed: -x to +x)
=== modified file 'base_company_prefix/__openerp__.py' (properties changed: -x to +x)
=== modified file 'base_company_prefix/base_company_prefix.py' (properties changed: -x to +x)
=== modified file 'base_company_prefix/base_company_prefix.xml' (properties changed: -x to +x)
=== modified file 'base_currency_symbol/__init__.py' (properties changed: -x to +x)
=== modified file 'base_currency_symbol/__terp__.py' (properties changed: -x to +x)
=== modified file 'base_currency_symbol/base_currency_symbol.py' (properties changed: -x to +x)
=== modified file 'base_currency_symbol/base_currency_symbol_data.xml' (properties changed: -x to +x)
=== modified file 'base_currency_symbol/base_currency_symbol_view.xml' (properties changed: -x to +x)
=== modified file 'base_import_exchange_rates/company.py' (properties changed: -x to +x)
=== modified file 'base_import_exchange_rates/i18n/fr_FR.po' (properties changed: -x to +x)
=== modified file 'base_import_exchange_rates/i18n/pl_PL.po' (properties changed: -x to +x)
=== modified file 'base_import_exchange_rates/wizard/__init__.py' (properties changed: -x to +x)
=== modified file 'base_partner_code/__init__.py' (properties changed: -x to +x)
=== modified file 'base_partner_code/__openerp__.py' (properties changed: -x to +x)
=== modified file 'base_partner_code/base_partner_code.py' (properties changed: -x to +x)
=== modified file 'base_partner_code/base_partner_code_view.xml' (properties changed: -x to +x)
=== modified file 'ccorp_payment_receipt/__init__.py' (properties changed: -x to +x)
=== modified file 'ccorp_payment_receipt/__terp__.py' (properties changed: -x to +x)
=== modified file 'ccorp_payment_receipt/data.xml' (properties changed: -x to +x)
=== modified file 'ccorp_payment_receipt/i18n/es_CR.po' (properties changed: -x to +x)
=== modified file 'ccorp_payment_receipt/payment_receipt_report.xml' (properties changed: -x to +x)
=== modified file 'ccorp_payment_receipt/report/__init__.py' (properties changed: -x to +x)
=== modified file 'ccorp_payment_receipt/report/amount_to_text.py' (properties changed: -x to +x)
=== modified file 'ccorp_payment_receipt/report/header.html' (properties changed: -x to +x)
=== modified file 'ccorp_payment_receipt/report/payment_receipt.mako' (properties changed: -x to +x)
=== modified file 'ccorp_payment_receipt/report/payment_receipt.py' (properties changed: -x to +x)
=== modified file 'ccorp_payment_receipt/report/style.css' (properties changed: -x to +x)
=== modified file 'project_project_name_shortcut/__init__.py' (properties changed: -x to +x)
=== modified file 'project_project_name_shortcut/__openerp__.py' (properties changed: -x to +x)
=== modified file 'project_project_name_shortcut/project_name_shortcut.py' (properties changed: -x to +x)
=== modified file 'project_project_name_shortcut/project_name_view.xml' (properties changed: -x to +x)
=== modified file 'rent/i18n/es_CR.po' (properties changed: -x to +x)
=== modified file 'sale_order_ccorp_report/__init__.py' (properties changed: -x to +x)
=== modified file 'sale_order_ccorp_report/__openerp__.py' (properties changed: -x to +x)
=== modified file 'sale_order_ccorp_report/ccorp_sale_webkit_report.xml' (properties changed: -x to +x)
=== modified file 'sale_order_ccorp_report/i18n/ccorp_sale.pot' (properties changed: -x to +x)
=== modified file 'sale_order_ccorp_report/i18n/ccorp_sale_webkit.pot' (properties changed: -x to +x)
=== modified file 'sale_order_ccorp_report/i18n/es.po' (properties changed: -x to +x)
=== modified file 'sale_order_ccorp_report/i18n/es_CR.po' (properties changed: -x to +x)
=== modified file 'sale_order_ccorp_report/report/__init__.py' (properties changed: -x to +x)
=== modified file 'sale_order_ccorp_report/report/sale_order.mako' (properties changed: -x to +x)
=== modified file 'sale_order_ccorp_report/report/sale_order.py' (properties changed: -x to +x)
=== modified file 'winpdb_debugger/__init__.py' (properties changed: -x to +x)
=== modified file 'winpdb_debugger/__terp__.py' (properties changed: -x to +x)
=== modified file 'winpdb_debugger/winpdb_debugger.py' (properties changed: -x to +x)
=== modified file 'winpdb_debugger/winpdb_debugger_wizard.xml' (properties changed: -x to +x)
Follow ups