From 887ab90afb5a0f9dc1a8388aa8459f82c908550f Mon Sep 17 00:00:00 2001 From: "HDA (OpenERP)" Date: Tue, 2 Feb 2010 11:40:46 +0530 Subject: [PATCH] Added account_anglo_saxon module from extra addons bzr revid: hda@tinyerp.com-20100202061046-oxp8cwjmy0ggtra4 --- addons/account_anglo_saxon/__init__.py | 25 +++ addons/account_anglo_saxon/__terp__.py | 39 +++++ .../i18n/account_anglo_saxon.pot | 54 ++++++ addons/account_anglo_saxon/i18n/fr_BE.po | 54 ++++++ addons/account_anglo_saxon/i18n/pl.po | 66 ++++++++ addons/account_anglo_saxon/invoice.py | 158 ++++++++++++++++++ addons/account_anglo_saxon/product.py | 55 ++++++ addons/account_anglo_saxon/product_view.xml | 53 ++++++ addons/account_anglo_saxon/purchase.py | 41 +++++ addons/account_anglo_saxon/sale.py | 43 +++++ addons/account_anglo_saxon/stock.py | 51 ++++++ 11 files changed, 639 insertions(+) create mode 100644 addons/account_anglo_saxon/__init__.py create mode 100644 addons/account_anglo_saxon/__terp__.py create mode 100644 addons/account_anglo_saxon/i18n/account_anglo_saxon.pot create mode 100644 addons/account_anglo_saxon/i18n/fr_BE.po create mode 100644 addons/account_anglo_saxon/i18n/pl.po create mode 100644 addons/account_anglo_saxon/invoice.py create mode 100644 addons/account_anglo_saxon/product.py create mode 100644 addons/account_anglo_saxon/product_view.xml create mode 100644 addons/account_anglo_saxon/purchase.py create mode 100644 addons/account_anglo_saxon/sale.py create mode 100644 addons/account_anglo_saxon/stock.py diff --git a/addons/account_anglo_saxon/__init__.py b/addons/account_anglo_saxon/__init__.py new file mode 100644 index 00000000000..dd9a9262710 --- /dev/null +++ b/addons/account_anglo_saxon/__init__.py @@ -0,0 +1,25 @@ +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2009 Tiny SPRL (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +import product +import stock +import purchase +import invoice +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/account_anglo_saxon/__terp__.py b/addons/account_anglo_saxon/__terp__.py new file mode 100644 index 00000000000..31818e213ef --- /dev/null +++ b/addons/account_anglo_saxon/__terp__.py @@ -0,0 +1,39 @@ +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2009 Tiny SPRL (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## +{ + "name" : "Stock Account", + "version" : "1.1", + "author" : "Tiny", + "website" : "http://tinyerp.com", + "description" : """This module will support the Anglo-Saxons accounting methodology by + changing the accounting logic with stock transactions. The difference between the Anglo-Saxon accounting countries + and the Rhine or also called Continental accounting countries is the moment of taking the Cost of Goods Sold versus Cost of Sales. + Anglo-Saxons accounting does take the cost when sales invoice is created, Continental accounting will take the cost at he moment the goods are shipped. + This module will add this functionality by using a interim account, to store the value of shipped goods and will contra book this interim account + when the invoice is created to transfer this amount to the debtor or creditor account.""", + "depends" : ["product", "account", "sale", "purchase"], + "category" : "Generic Modules/Inventory Control", + "init_xml" : [], + "demo_xml" : [], + "update_xml" : ["product_view.xml",], + "active": False, + "installable": True +} +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/account_anglo_saxon/i18n/account_anglo_saxon.pot b/addons/account_anglo_saxon/i18n/account_anglo_saxon.pot new file mode 100644 index 00000000000..a2d316633a4 --- /dev/null +++ b/addons/account_anglo_saxon/i18n/account_anglo_saxon.pot @@ -0,0 +1,54 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * account_anglo_saxon +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 5.0.6\n" +"Report-Msgid-Bugs-To: support@openerp.com\n" +"POT-Creation-Date: 2009-11-24 12:50:50+0000\n" +"PO-Revision-Date: 2009-11-24 12:50:50+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: account_anglo_saxon +#: view:product.category:0 +msgid " Accounting Property" +msgstr "" + +#. module: account_anglo_saxon +#: model:ir.module.module,description:account_anglo_saxon.module_meta_information +msgid "This module will support the Anglo-Saxons accounting methodology by \n" +" changing the accounting logic with stock transactions. The difference between the Anglo-Saxon accounting countries \n" +" and the Rhine or also called Continental accounting countries is the moment of taking the Cost of Goods Sold versus Cost of Sales. \n" +" Anglo-Saxons accounting does take the cost when sales invoice is created, Continental accounting will take the cost at he moment the goods are shipped.\n" +" This module will add this functionality by using a interim account, to store the value of shipped goods and will contra book this interim account \n" +" when the invoice is created to transfer this amount to the debtor or creditor account." +msgstr "" + +#. module: account_anglo_saxon +#: model:ir.module.module,shortdesc:account_anglo_saxon.module_meta_information +msgid "Stock Account" +msgstr "" + +#. module: account_anglo_saxon +#: constraint:ir.ui.view:0 +msgid "Invalid XML for View Architecture!" +msgstr "" + +#. module: account_anglo_saxon +#: field:product.category,property_account_creditor_price_difference_categ:0 +#: field:product.template,property_account_creditor_price_difference:0 +msgid "Price Difference Account" +msgstr "" + +#. module: account_anglo_saxon +#: help:product.category,property_account_creditor_price_difference_categ:0 +#: help:product.template,property_account_creditor_price_difference:0 +msgid "This account will be used to value price difference between purchase price and cost price." +msgstr "" + diff --git a/addons/account_anglo_saxon/i18n/fr_BE.po b/addons/account_anglo_saxon/i18n/fr_BE.po new file mode 100644 index 00000000000..a2d316633a4 --- /dev/null +++ b/addons/account_anglo_saxon/i18n/fr_BE.po @@ -0,0 +1,54 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * account_anglo_saxon +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 5.0.6\n" +"Report-Msgid-Bugs-To: support@openerp.com\n" +"POT-Creation-Date: 2009-11-24 12:50:50+0000\n" +"PO-Revision-Date: 2009-11-24 12:50:50+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: account_anglo_saxon +#: view:product.category:0 +msgid " Accounting Property" +msgstr "" + +#. module: account_anglo_saxon +#: model:ir.module.module,description:account_anglo_saxon.module_meta_information +msgid "This module will support the Anglo-Saxons accounting methodology by \n" +" changing the accounting logic with stock transactions. The difference between the Anglo-Saxon accounting countries \n" +" and the Rhine or also called Continental accounting countries is the moment of taking the Cost of Goods Sold versus Cost of Sales. \n" +" Anglo-Saxons accounting does take the cost when sales invoice is created, Continental accounting will take the cost at he moment the goods are shipped.\n" +" This module will add this functionality by using a interim account, to store the value of shipped goods and will contra book this interim account \n" +" when the invoice is created to transfer this amount to the debtor or creditor account." +msgstr "" + +#. module: account_anglo_saxon +#: model:ir.module.module,shortdesc:account_anglo_saxon.module_meta_information +msgid "Stock Account" +msgstr "" + +#. module: account_anglo_saxon +#: constraint:ir.ui.view:0 +msgid "Invalid XML for View Architecture!" +msgstr "" + +#. module: account_anglo_saxon +#: field:product.category,property_account_creditor_price_difference_categ:0 +#: field:product.template,property_account_creditor_price_difference:0 +msgid "Price Difference Account" +msgstr "" + +#. module: account_anglo_saxon +#: help:product.category,property_account_creditor_price_difference_categ:0 +#: help:product.template,property_account_creditor_price_difference:0 +msgid "This account will be used to value price difference between purchase price and cost price." +msgstr "" + diff --git a/addons/account_anglo_saxon/i18n/pl.po b/addons/account_anglo_saxon/i18n/pl.po new file mode 100644 index 00000000000..f23f6949fee --- /dev/null +++ b/addons/account_anglo_saxon/i18n/pl.po @@ -0,0 +1,66 @@ +# Polish translation for openobject-addons +# Copyright (c) 2010 Rosetta Contributors and Canonical Ltd 2010 +# This file is distributed under the same license as the openobject-addons package. +# FIRST AUTHOR , 2010. +# +msgid "" +msgstr "" +"Project-Id-Version: openobject-addons\n" +"Report-Msgid-Bugs-To: FULL NAME \n" +"POT-Creation-Date: 2009-11-24 12:50+0000\n" +"PO-Revision-Date: 2010-01-06 01:42+0000\n" +"Last-Translator: Fabien (Open ERP) \n" +"Language-Team: Polish \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Launchpad-Export-Date: 2010-01-22 04:42+0000\n" +"X-Generator: Launchpad (build Unknown)\n" + +#. module: account_anglo_saxon +#: view:product.category:0 +msgid " Accounting Property" +msgstr "" + +#. module: account_anglo_saxon +#: model:ir.module.module,description:account_anglo_saxon.module_meta_information +msgid "" +"This module will support the Anglo-Saxons accounting methodology by \n" +" changing the accounting logic with stock transactions. The difference " +"between the Anglo-Saxon accounting countries \n" +" and the Rhine or also called Continental accounting countries is the " +"moment of taking the Cost of Goods Sold versus Cost of Sales. \n" +" Anglo-Saxons accounting does take the cost when sales invoice is " +"created, Continental accounting will take the cost at he moment the goods " +"are shipped.\n" +" This module will add this functionality by using a interim account, to " +"store the value of shipped goods and will contra book this interim account \n" +" when the invoice is created to transfer this amount to the debtor or " +"creditor account." +msgstr "" + +#. module: account_anglo_saxon +#: model:ir.module.module,shortdesc:account_anglo_saxon.module_meta_information +msgid "Stock Account" +msgstr "" + +#. module: account_anglo_saxon +#: constraint:ir.ui.view:0 +msgid "Invalid XML for View Architecture!" +msgstr "XML niewłaściwy dla tej architektury wyświetlania!" + +#. module: account_anglo_saxon +#: field:product.category,property_account_creditor_price_difference_categ:0 +#: field:product.template,property_account_creditor_price_difference:0 +msgid "Price Difference Account" +msgstr "Konto różnic cenowych" + +#. module: account_anglo_saxon +#: help:product.category,property_account_creditor_price_difference_categ:0 +#: help:product.template,property_account_creditor_price_difference:0 +msgid "" +"This account will be used to value price difference between purchase price " +"and cost price." +msgstr "" +"To konto będzie stosowane do rejestrowania różnic cenowych między ceną " +"zakupu a kosztem." diff --git a/addons/account_anglo_saxon/invoice.py b/addons/account_anglo_saxon/invoice.py new file mode 100644 index 00000000000..3904cd6b01e --- /dev/null +++ b/addons/account_anglo_saxon/invoice.py @@ -0,0 +1,158 @@ +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2009 Tiny SPRL (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from osv import fields, osv + +class account_invoice_line(osv.osv): + _inherit = "account.invoice.line" + + def move_line_get(self, cr, uid, invoice_id, context=None): + res = super(account_invoice_line,self).move_line_get(cr, uid, invoice_id, context) + inv = self.pool.get('account.invoice').browse(cr, uid, invoice_id) + if inv.type in ('out_invoice','out_refund'): + for i_line in inv.invoice_line: + if i_line.product_id: + if inv.type == 'out_invoice': + dacc = i_line.product_id.product_tmpl_id.property_stock_account_output and i_line.product_id.product_tmpl_id.property_stock_account_output.id + if not dacc: + dacc = i_line.product_id.categ_id.property_stock_account_output_categ and i_line.product_id.categ_id.property_stock_account_output_categ.id + else: + dacc = i_line.product_id.product_tmpl_id.property_stock_account_input and i_line.product_id.product_tmpl_id.property_stock_account_input.id + if not dacc: + dacc = i_line.product_id.categ_id.property_stock_account_input_categ and i_line.product_id.categ_id.property_stock_account_input_categ.id + + cacc = i_line.product_id.product_tmpl_id.property_account_expense and i_line.product_id.product_tmpl_id.property_account_expense.id + if not cacc: + cacc = i_line.product_id.categ_id.property_account_expense_categ and i_line.product_id.categ_id.property_account_expense_categ.id + if dacc and cacc: + res.append({ + 'type':'src', + 'name': i_line.name[:64], + 'price_unit':i_line.product_id.product_tmpl_id.standard_price, + 'quantity':i_line.quantity, + 'price':i_line.product_id.product_tmpl_id.standard_price * i_line.quantity, + 'account_id':dacc, + 'product_id':i_line.product_id.id, + 'uos_id':i_line.uos_id.id, + 'account_analytic_id':i_line.account_analytic_id.id, + 'taxes':i_line.invoice_line_tax_id, + }) + + res.append({ + 'type':'src', + 'name': i_line.name[:64], + 'price_unit':i_line.product_id.product_tmpl_id.standard_price, + 'quantity':i_line.quantity, + 'price': -1 * i_line.product_id.product_tmpl_id.standard_price * i_line.quantity, + 'account_id':cacc, + 'product_id':i_line.product_id.id, + 'uos_id':i_line.uos_id.id, + 'account_analytic_id':i_line.account_analytic_id.id, + 'taxes':i_line.invoice_line_tax_id, + }) + elif inv.type in ('in_invoice','in_refund'): + for i_line in inv.invoice_line: + if i_line.product_id: + if i_line.product_id.product_tmpl_id.type != 'service': + acc = i_line.product_id.product_tmpl_id.property_account_creditor_price_difference and i_line.product_id.product_tmpl_id.property_account_creditor_price_difference.id + if not acc: + acc = i_line.product_id.categ_id.property_account_creditor_price_difference_categ and i_line.product_id.categ_id.property_account_creditor_price_difference_categ.id + a = None + if inv.type == 'in_invoice': + oa = i_line.product_id.product_tmpl_id.property_stock_account_input and i_line.product_id.product_tmpl_id.property_stock_account_input.id + if not oa: + oa = i_line.product_id.categ_id.property_stock_account_input_categ and i_line.product_id.categ_id.property_stock_account_input_categ.id + else: + oa = i_line.product_id.product_tmpl_id.property_stock_account_output and i_line.product_id.product_tmpl_id.property_stock_account_output.id + if not oa: + oa = i_line.product_id.categ_id.property_stock_account_output_categ and i_line.product_id.categ_id.property_stock_account_output_categ.id + if oa: + fpos = i_line.invoice_id.fiscal_position or False + a = self.pool.get('account.fiscal.position').map_account(cr, uid, fpos, oa) + diff_res = [] + for line in res: + if a == line['account_id'] and i_line.product_id.id == line['product_id']: + uom = i_line.product_id.uos_id or i_line.product_id.uom_id + standard_price = self.pool.get('product.uom')._compute_price(cr, uid, uom.id, i_line.product_id.product_tmpl_id.standard_price, i_line.uos_id.id) + if standard_price != i_line.price_unit and line['price'] == i_line.price_unit and acc: + price_diff = i_line.price_unit - standard_price + line.update({'price':standard_price * line['quantity']}) + diff_res.append({ + 'type':'src', + 'name': i_line.name[:64], + 'price_unit':price_diff, + 'quantity':line['quantity'], + 'price': price_diff * line['quantity'], + 'account_id':acc, + 'product_id':line['product_id'], + 'uos_id':line['uos_id'], + 'account_analytic_id':line['account_analytic_id'], + 'taxes':line.get('taxes',[]), + }) + res += diff_res + return res + + def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, address_invoice_id=False, context=None): + if not product: + return super(account_invoice_line, self).product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fposition_id, price_unit, address_invoice_id, context) + else: + res = super(account_invoice_line, self).product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fposition_id, price_unit, address_invoice_id, context) + + if type in ('in_invoice','in_refund'): + product_obj = self.pool.get('product.product').browse(cr, uid, product, context=context) + if type == 'in_invoice': + oa = product_obj.product_tmpl_id.property_stock_account_input and product_obj.product_tmpl_id.property_stock_account_input.id + if not oa: + oa = product_obj.categ_id.property_stock_account_input_categ and product_obj.categ_id.property_stock_account_input_categ.id + else: + oa = product_obj.product_tmpl_id.property_stock_account_output and product_obj.product_tmpl_id.property_stock_account_output.id + if not oa: + oa = product_obj.categ_id.property_stock_account_output_categ and product_obj.categ_id.property_stock_account_output_categ.id + if oa: + fpos = fposition_id and self.pool.get('account.fiscal.position').browse(cr, uid, fposition_id) or False + a = self.pool.get('account.fiscal.position').map_account(cr, uid, fpos, oa) + res['value'].update({'account_id':a}) + return res + +account_invoice_line() + +class account_invoice(osv.osv): + _inherit = "account.invoice" + + def _refund_cleanup_lines(self, cr, uid, lines): + for line in lines: + inv_id = line['invoice_id'] + inv_obj = self.browse(cr,uid,inv_id[0]) + if inv_obj.type == 'in_invoice': + if line.get('product_id',False): + product_obj = self.pool.get('product.product').browse(cr,uid,line['product_id'][0]) + oa = product_obj.product_tmpl_id.property_stock_account_output and product_obj.product_tmpl_id.property_stock_account_output.id + if not oa: + oa = product_obj.categ_id.property_stock_account_output_categ and product_obj.categ_id.property_stock_account_output_categ.id + if oa: + fpos = inv_obj.fiscal_position or False + a = self.pool.get('account.fiscal.position').map_account(cr, uid, fpos, oa) + account_data = self.pool.get('account.account').read(cr,uid,[a],['name'])[0] + line.update({'account_id': (account_data['id'],account_data['name'])}) + res = super(account_invoice,self)._refund_cleanup_lines(cr, uid, lines) + return res + +account_invoice() +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/account_anglo_saxon/product.py b/addons/account_anglo_saxon/product.py new file mode 100644 index 00000000000..acd6577fbb7 --- /dev/null +++ b/addons/account_anglo_saxon/product.py @@ -0,0 +1,55 @@ +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2009 Tiny SPRL (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from osv import fields, osv + +class product_category(osv.osv): + _inherit = "product.category" + _columns = { + 'property_account_creditor_price_difference_categ': fields.property( + 'account.account', + type='many2one', + relation='account.account', + string="Price Difference Account", + method=True, + view_load=True, + help="This account will be used to value price difference between purchase price and cost price."), + + } +product_category() + +class product_template(osv.osv): + _inherit = "product.template" + _columns = { + 'property_account_creditor_price_difference': fields.property( + 'account.account', + type='many2one', + relation='account.account', + string="Price Difference Account", + method=True, + view_load=True, + help="This account will be used to value price difference between purchase price and cost price."), + + } +product_template() + + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + diff --git a/addons/account_anglo_saxon/product_view.xml b/addons/account_anglo_saxon/product_view.xml new file mode 100644 index 00000000000..78e51374128 --- /dev/null +++ b/addons/account_anglo_saxon/product_view.xml @@ -0,0 +1,53 @@ + + + + + product.normal.form.inherit.stock + product.product + form + + + + + + + + + + + + + product.template.product.form.inherit + product.template + form + + + + + + + + + + + + + product.category.property.form.inherit.stock + product.category + form + + +
+ + + + + + +
+
+
+ +
+
+ diff --git a/addons/account_anglo_saxon/purchase.py b/addons/account_anglo_saxon/purchase.py new file mode 100644 index 00000000000..98694a3d5dd --- /dev/null +++ b/addons/account_anglo_saxon/purchase.py @@ -0,0 +1,41 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2009 Tiny SPRL (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from osv import fields, osv + +class purchase_order(osv.osv): + _name = "purchase.order" + _inherit = "purchase.order" + _description = "Purchase order" + + def inv_line_create(self, cr, uid, a, ol): + line = super(purchase_order, self).inv_line_create(cr, uid, a, ol) + if ol.product_id: + oa = ol.product_id.product_tmpl_id.property_stock_account_input and ol.product_id.product_tmpl_id.property_stock_account_input.id + if not oa: + oa = ol.product_id.categ_id.property_stock_account_input_categ and ol.product_id.categ_id.property_stock_account_input_categ.id + if oa: + fpos = ol.order_id.fiscal_position or False + a = self.pool.get('account.fiscal.position').map_account(cr, uid, fpos, oa) + line[2].update({'account_id': a}) + return line +purchase_order() +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/account_anglo_saxon/sale.py b/addons/account_anglo_saxon/sale.py new file mode 100644 index 00000000000..e2cfa7bbb3b --- /dev/null +++ b/addons/account_anglo_saxon/sale.py @@ -0,0 +1,43 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2009 Tiny SPRL (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from osv import fields, osv + +#class sale_order_line(osv.osv): +# _name = 'sale.order.line' +# _description = 'Sale Order line' +# _inherit = 'sale.order.line' +# +# def invoice_line_create(self, cr, uid, ids, context={}): +# line_ids = super('sale_order_line',self).invoice_line_create(cr, uid, ids, context) +# invoice_line_obj = self.pool.get('account.invoice.line') +# for line in invoice_line_obj.browse(cr, uid, line_ids): +# if line.product_id: +# a = line.product_id.product_tmpl_id.property_stock_account_output and line.product_id.product_tmpl_id.property_stock_account_output.id +# if not a: +# a = line.product_id.categ_id.property_stock_account_output_categ and line.product_id.categ_id.property_stock_account_output_categ.id +# if a: +# a = self.pool.get('account.fiscal.position').map_account(cr, uid, fpos, a) +# invoice_line_obj.write(cr, uid, line.id, {'account_id':a}) +# +#sale_order_line() + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account_anglo_saxon/stock.py b/addons/account_anglo_saxon/stock.py new file mode 100644 index 00000000000..ad091364fd8 --- /dev/null +++ b/addons/account_anglo_saxon/stock.py @@ -0,0 +1,51 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2009 Tiny SPRL (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from osv import fields,osv + +#---------------------------------------------------------- +# Stock Picking +#---------------------------------------------------------- +class stock_picking(osv.osv): + _inherit = "stock.picking" + _description = "Packing List" + + def action_invoice_create(self, cr, uid, ids, journal_id=False, + group=False, type='out_invoice', context=None): + '''Return ids of created invoices for the pickings''' + res = super(stock_picking,self).action_invoice_create(cr, uid, ids, journal_id, group, type, context) + if type == 'in_refund': + for inv in self.pool.get('account.invoice').browse(cr, uid, res.values(), context=context): + for ol in inv.invoice_line: + if ol.product_id: + oa = ol.product_id.product_tmpl_id.property_stock_account_output and ol.product_id.product_tmpl_id.property_stock_account_output.id + if not oa: + oa = ol.product_id.categ_id.property_stock_account_output_categ and ol.product_id.categ_id.property_stock_account_output_categ.id + if oa: + fpos = ol.invoice_id.fiscal_position or False + a = self.pool.get('account.fiscal.position').map_account(cr, uid, fpos, oa) + self.pool.get('account.invoice.line').write(cr, uid, [ol.id], {'account_id': a}) + return res + +stock_picking() + + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: