savoirfairelinux-openerp team mailing list archive
-
savoirfairelinux-openerp team
-
Mailing list archive
-
Message #00011
[Merge] lp:~extra-addons-commiter/e-commerce-addons/oerp6.1-cleanning into lp:e-commerce-addons/oerp6.1-stable
Sébastien BEAU - http://www.akretion.com has proposed merging lp:~extra-addons-commiter/e-commerce-addons/oerp6.1-cleanning into lp:e-commerce-addons/oerp6.1-stable.
Requested reviews:
extra-addons-commiter (extra-addons-commiter)
For more details, see:
https://code.launchpad.net/~extra-addons-commiter/e-commerce-addons/oerp6.1-cleanning/+merge/135017
--
https://code.launchpad.net/~extra-addons-commiter/e-commerce-addons/oerp6.1-cleanning/+merge/135017
Your team extra-addons-commiter is requested to review the proposed merge of lp:~extra-addons-commiter/e-commerce-addons/oerp6.1-cleanning into lp:e-commerce-addons/oerp6.1-stable.
=== added directory 'base_sale_export_partner'
=== added file 'base_sale_export_partner/__init__.py'
--- base_sale_export_partner/__init__.py 1970-01-01 00:00:00 +0000
+++ base_sale_export_partner/__init__.py 2012-11-19 23:40:29 +0000
@@ -0,0 +1,23 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# Base sale export partner module for OpenERP
+# Copyright (C) 2012 Akretion (http://www.akretion.com). All Rights Reserved
+# @author Alexis de Lattre <alexis.delattre@xxxxxxxxxxxx>
+#
+# 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 <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import wizard
=== added file 'base_sale_export_partner/__openerp__.py'
--- base_sale_export_partner/__openerp__.py 1970-01-01 00:00:00 +0000
+++ base_sale_export_partner/__openerp__.py 2012-11-19 23:40:29 +0000
@@ -0,0 +1,41 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# Base sale export partner module for OpenERP
+# Copyright (C) 2012 Akretion (http://www.akretion.com). All Rights Reserved
+# @author Alexis de Lattre <alexis.delattre@xxxxxxxxxxxx>
+#
+# 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 <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+
+{
+ 'name': 'Base sale multichannels - Export partners',
+ 'version': '1.0',
+ 'category': 'Sales Management',
+ 'license': 'AGPL-3',
+ 'description': """This module contains a wizard to export one or several partners "manually" to an external shop such as a Magento shop, a PrestaShop boutique, Amazon or eBay.
+ """,
+ 'author': 'Akretion',
+ 'website': 'http://www.akretion.com',
+ 'depends': ['base_sale_multichannels'],
+ 'init_xml': [],
+ 'update_xml': [
+ 'wizard/export_partner.xml',
+ ],
+ 'demo_xml': [],
+ 'installable': True,
+ 'active': False,
+}
=== added directory 'base_sale_export_partner/wizard'
=== added file 'base_sale_export_partner/wizard/__init__.py'
--- base_sale_export_partner/wizard/__init__.py 1970-01-01 00:00:00 +0000
+++ base_sale_export_partner/wizard/__init__.py 2012-11-19 23:40:29 +0000
@@ -0,0 +1,23 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# Base sale export partner module for OpenERP
+# Copyright (C) 2012 Akretion (http://www.akretion.com). All Rights Reserved
+# @author Alexis de Lattre <alexis.delattre@xxxxxxxxxxxx>
+#
+# 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 <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import export_partner
=== added file 'base_sale_export_partner/wizard/export_partner.py'
--- base_sale_export_partner/wizard/export_partner.py 1970-01-01 00:00:00 +0000
+++ base_sale_export_partner/wizard/export_partner.py 2012-11-19 23:40:29 +0000
@@ -0,0 +1,67 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Base sale export partner module for OpenERP
+# Copyright (C) 2012 Akretion (http://www.akretion.com). All Rights Reserved
+# @author Alexis de Lattre <alexis.delattre@xxxxxxxxxxxx>
+#
+# 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 <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+
+from openerp.osv.orm import TransientModel
+from openerp.osv import fields
+from openerp.osv.osv import except_osv
+from openerp.tools.translate import _
+from base_external_referentials.external_osv import ExternalSession
+
+class partner_export_wizard(TransientModel):
+ _name = 'partner.export.wizard'
+ _description = 'partner export wizard'
+
+
+ _columns = {
+ 'shop': fields.many2many('sale.shop', 'shop_partner_rel', 'shop_id', 'partner_id', 'Shop', required=True),
+ }
+
+
+ def export_partner(self, cr, uid, id, context=None):
+ if context is None:
+ context = {}
+ shop_ids = self.read(cr, uid, id, context=context)[0]['shop']
+ sale_shop_obj = self.pool.get('sale.shop')
+ partner_obj = self.pool.get('res.partner')
+ addr_obj = self.pool.get('res.partner.address')
+ partner_ids = context.get('active_ids')
+ if not partner_ids:
+ # This should never happen
+ raise osv.except_osv(_('User Error'), 'No partner selected !')
+
+ for shop in sale_shop_obj.browse(cr, uid, shop_ids, context=context):
+ if not shop.referential_id:
+ raise except_osv(_("User Error"), _("The shop '%s' doesn't have any external referential. Are you sure that it's an external sale shop? If yes, synchronize it before exporting partners." % shop.name))
+ external_session = ExternalSession(shop.referential_id, shop)
+ context = self.pool.get('sale.shop').init_context_before_exporting_resource(cr, uid, external_session, shop.id, 'res.partner', context=context)
+ for partner in partner_obj.read(cr, uid, partner_ids, ['address'], context=context):
+ #print "partner_id=", partner_id
+ partner_obj._export_one_resource(cr, uid, external_session, partner['id'], context=context)
+ partner_obj.write(cr, uid, partner['id'], {
+ 'shop_ids': [(4, shop.id)],
+ }, context=context)
+ #print "addr=", partner['address']
+ for address_id in partner['address']:
+ addr_obj._export_one_resource(cr, uid, external_session, address_id, context=context)
+ return {'type': 'ir.actions.act_window_close'}
+
=== added file 'base_sale_export_partner/wizard/export_partner.xml'
--- base_sale_export_partner/wizard/export_partner.xml 1970-01-01 00:00:00 +0000
+++ base_sale_export_partner/wizard/export_partner.xml 2012-11-19 23:40:29 +0000
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+<data>
+
+
+<record id="partner_export_wizard_form" model="ir.ui.view">
+ <field name="name">partner.export.wizard.form</field>
+ <field name="model">partner.export.wizard</field>
+ <field name="type">form</field>
+ <field name="arch" type="xml">
+ <form>
+ <label string="Select the shops to export to:" colspan="4"/>
+ <field name="shop" nolabel="1" colspan="4"/>
+ <button icon="gtk-cancel" special="cancel" string="Cancel" colspan="2"/>
+ <button icon="gtk-ok" name="export_partner" string="Export Partner" type="object" colspan="2"/>
+ </form>
+ </field>
+</record>
+
+<record id="action_partner_export_wizard" model="ir.actions.act_window">
+ <field name="name">Export Partner</field>
+ <field name="res_model">partner.export.wizard</field>
+ <field name="view_type">form</field>
+ <field name="view_mode">form</field>
+ <field name="target">new</field>
+</record>
+
+<record id="ir_values_partner_export_wizard" model="ir.values">
+ <field name="key2">client_action_multi</field>
+ <field name="model">res.partner</field>
+ <field name="name">Export Partner</field>
+ <field name="value" eval="'ir.actions.act_window,%d'%action_partner_export_wizard"/>
+ <field name="object" eval="True"/>
+</record>
+
+
+</data>
+</openerp>
=== added directory 'base_sale_export_product'
=== added file 'base_sale_export_product/__init__.py'
--- base_sale_export_product/__init__.py 1970-01-01 00:00:00 +0000
+++ base_sale_export_product/__init__.py 2012-11-19 23:40:29 +0000
@@ -0,0 +1,23 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# Base sale export product module for OpenERP
+# Copyright (C) 2012 Akretion (http://www.akretion.com). All Rights Reserved
+# @author Alexis de Lattre <alexis.delattre@xxxxxxxxxxxx>
+#
+# 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 <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import wizard
=== added file 'base_sale_export_product/__openerp__.py'
--- base_sale_export_product/__openerp__.py 1970-01-01 00:00:00 +0000
+++ base_sale_export_product/__openerp__.py 2012-11-19 23:40:29 +0000
@@ -0,0 +1,41 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# Base sale export product module for OpenERP
+# Copyright (C) 2012 Akretion (http://www.akretion.com). All Rights Reserved
+# @author Alexis de Lattre <alexis.delattre@xxxxxxxxxxxx>
+#
+# 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 <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+
+{
+ 'name': 'Base sale multichannels - Export products',
+ 'version': '1.0',
+ 'category': 'Sales Management',
+ 'license': 'AGPL-3',
+ 'description': """This module contains a wizard to export one or several products "manually" to an external shop such as a Magento shop, a PrestaShop boutique, Amazon or eBay.
+ """,
+ 'author': 'Akretion',
+ 'website': 'http://www.akretion.com',
+ 'depends': ['base_sale_multichannels'],
+ 'init_xml': [],
+ 'update_xml': [
+ 'wizard/export_product.xml',
+ ],
+ 'demo_xml': [],
+ 'installable': True,
+ 'active': False,
+}
=== added directory 'base_sale_export_product/wizard'
=== added file 'base_sale_export_product/wizard/__init__.py'
--- base_sale_export_product/wizard/__init__.py 1970-01-01 00:00:00 +0000
+++ base_sale_export_product/wizard/__init__.py 2012-11-19 23:40:29 +0000
@@ -0,0 +1,23 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# Base sale export product module for OpenERP
+# Copyright (C) 2012 Akretion (http://www.akretion.com). All Rights Reserved
+# @author Alexis de Lattre <alexis.delattre@xxxxxxxxxxxx>
+#
+# 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 <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import export_product
=== added file 'base_sale_export_product/wizard/export_product.py'
--- base_sale_export_product/wizard/export_product.py 1970-01-01 00:00:00 +0000
+++ base_sale_export_product/wizard/export_product.py 2012-11-19 23:40:29 +0000
@@ -0,0 +1,90 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Base sale export product module for OpenERP
+# Copyright (C) 2010-2012 Sébastien BEAU <sebastien.beau@xxxxxxxxxxxx>
+#
+# 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 <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+
+from openerp.osv.orm import TransientModel
+from openerp.osv import fields
+from openerp.osv.osv import except_osv
+from openerp.tools.translate import _
+from base_external_referentials.external_osv import ExternalSession
+
+class product_export_wizard(TransientModel):
+ _name = 'product.export.wizard'
+ _description = 'product export wizard'
+
+ _columns = {
+ 'shop': fields.many2many('sale.shop', 'shop_rel', 'shop_id', 'product_id', 'Shop', required=True),
+ }
+
+ def _export_one_product(self, cr, uid, external_session, product_id, options, context=None):
+ product_obj = self.pool.get('product.product')
+ if 'export_product' in options:
+ product_obj._export_one_resource(cr, uid, external_session, product_id, context=context)
+ if 'export_inventory' in options:
+ product_obj.export_inventory(cr, uid, external_session, [product_id], context=context)
+ if 'export_image' in options:
+ product_obj.export_product_images(cr, uid, external_session, [product_id], context=context)
+ return True
+
+ def export(self, cr, uid, id, options, context=None):
+ if context is None:
+ context={}
+ shop_ids = self.read(cr, uid, id, context=context)[0]['shop']
+ sale_shop_obj = self.pool.get('sale.shop')
+ product_obj = self.pool.get('product.product')
+ product_ids = context['active_ids']
+
+ for shop in sale_shop_obj.browse(cr, uid, shop_ids, context=context):
+ if not shop.referential_id:
+ raise except_osv(_("User Error"), _(("The shop '%s' doesn't have any external "
+ "referential are you sure that it's an externe sale shop?"
+ "If yes syncronize it before exporting product"))%(shop.name,))
+ external_session = ExternalSession(shop.referential_id, shop)
+ context = self.pool.get('sale.shop').init_context_before_exporting_resource(cr, uid, external_session, shop.id, 'product.product', context=context)
+ none_exportable_product = set(product_ids) - set([product.id for product in shop.exportable_product_ids])
+ if none_exportable_product:
+ products = ', '.join([x['name'] for x in product_obj.read(cr, uid, list(none_exportable_product), fields = ['name'], context=context)])
+ raise except_osv(_("User Error"),
+ _(("The product '%s' can not be exported to the shop '%s'. \n"
+ "Please check : \n"
+ " - if they are in the root category \n"
+ " - if the website option is correctly configured. \n"
+ " - if the check box to export the product to the shop is checked"))%(products, shop.name))
+ for product_id in product_ids:
+ self._export_one_product(cr, uid, external_session, product_id, options, context=context)
+ return {'type': 'ir.actions.act_window_close'}
+
+ def export_product(self, cr, uid, id, context=None):
+ return self.export(cr, uid, id, ['export_product'], context)
+
+ def export_inventory(self, cr, uid, id, context=None):
+ return self.export(
+ cr, uid, id, ['export_inventory'], context)
+
+ def export_image(self, cr, uid, id, context=None):
+ return self.export(
+ cr, uid, id, ['export_image'], context)
+
+ def _get_all_options(self, cr, uid, context=None):
+ return ['export_product', 'export_inventory', 'export_image']
+
+ def export_all(self, cr, uid, id, context=None):
+ return self.export(cr, uid, id, self._get_all_options(cr, uid, context=context), context)
=== added file 'base_sale_export_product/wizard/export_product.xml'
--- base_sale_export_product/wizard/export_product.xml 1970-01-01 00:00:00 +0000
+++ base_sale_export_product/wizard/export_product.xml 2012-11-19 23:40:29 +0000
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data>
+
+ <record model="ir.ui.view" id="product_export_wizard_view">
+ <field name="name">product.export.wizard.view</field>
+ <field name="model">product.export.wizard</field>
+ <field name="type">form</field>
+ <field name="arch" type="xml">
+ <form string="Select the shops to export to">
+ <label string="Select the shops to export to:" colspan="4"/>
+ <field name="shop" nolabel="1" colspan="4"/>
+ <button icon="gtk-cancel" special="cancel" string="Cancel"/>
+ <button icon="gtk-ok" name="export_product" string="Export Product" type="object"/>
+ <button icon="gtk-ok" name="export_inventory" string="Export Stock" type="object"/>
+ <button icon="gtk-ok" name="export_image" string="Export Image" type="object"/>
+ <button icon="gtk-ok" name="export_all" string="Export All" type="object"/>
+ </form>
+ </field>
+ </record>
+
+ <record id="action_product_export_wizard" model="ir.actions.act_window">
+ <field name="name">Export Product</field>
+ <field name="res_model">product.export.wizard</field>
+ <field name="view_type">form</field>
+ <field name="view_mode">form</field>
+ <field name="target">new</field>
+ <field name="context">{}</field>
+ </record>
+
+ <record id="ir_action_export_product_wizard" model="ir.values">
+ <field name="key2">client_action_multi</field>
+ <field name="model">product.product</field>
+ <field name="name">Export Product</field>
+ <field eval="'ir.actions.act_window,%d'%action_product_export_wizard" name="value"/>
+ <field eval="True" name="object"/>
+ </record>
+ </data>
+</openerp>
=== modified file 'base_sale_multichannels/__init__.py'
--- base_sale_multichannels/__init__.py 2012-05-06 17:51:58 +0000
+++ base_sale_multichannels/__init__.py 2012-11-19 23:40:29 +0000
@@ -20,10 +20,8 @@
#
##############################################################################
-import ir_module # FIXME: TO REMOVE ONCE (IF) MERGED IN SERVER
import sale
import stock
-#import report
import wizard
import delivery
import partner
=== modified file 'base_sale_multichannels/__openerp__.py'
--- base_sale_multichannels/__openerp__.py 2012-06-11 08:06:11 +0000
+++ base_sale_multichannels/__openerp__.py 2012-11-19 23:40:29 +0000
@@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
-# OpenERP, Open Source Management Solution
+# OpenERP, Open Source Management Solution
# Copyright (C) 2009 Akretion (<http://www.akretion.com>). All Rights Reserved
# authors: Raphaël Valyi, Sharoon Thomas
# Copyright (C) 2010-2011 Akretion Sébastien BEAU <sebastien.beau@xxxxxxxxxxxx>
@@ -60,16 +60,16 @@
'update_xml': [
'security/ir.model.access.csv',
'sale_view.xml',
+ 'partner_view.xml',
'invoice_view.xml',
- 'wizard/export_product.xml',
'wizard/import_order.xml',
'delivery_view.xml',
'base_sale_data.xml',
'settings/sale.exception.csv',
'settings/external.referential.category.csv',
- 'external_referential_view.xml',
'stock_view.xml',
'payment_method_view.xml',
+ 'account_view.xml',
],
'demo_xml': [],
'installable': True,
=== modified file 'base_sale_multichannels/account.py'
--- base_sale_multichannels/account.py 2012-05-23 20:19:58 +0000
+++ base_sale_multichannels/account.py 2012-11-19 23:40:29 +0000
@@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
#################################################################################
# #
-# amazonerpconnect for OpenERP #
+# base_sale_multichannels for OpenERP #
# Copyright (C) 2011 Akretion Sébastien BEAU <sebastien.beau@xxxxxxxxxxxx> #
# #
# This program is free software: you can redistribute it and/or modify #
@@ -19,10 +19,10 @@
# #
#################################################################################
-from osv import osv, fields
-
-
-class account_tax_code(osv.osv):
+from openerp.osv.orm import Model
+from openerp.osv import fields
+
+class account_tax_code(Model):
_inherit='account.tax'
def get_tax_from_rate(self, cr, uid, rate, is_tax_included=False, context=None):
@@ -39,4 +39,21 @@
return tax_ids[0]
return False
-account_tax_code()
+class account_tax_group(Model):
+ _name = 'account.tax.group'
+ _description = 'account tax group'
+
+ _columns = {
+ 'name': fields.char('Name', size=64),
+ 'tax_ids': fields.one2many('account.tax', 'group_id', 'Taxes'),
+ }
+
+class account_tax(Model):
+ _inherit = 'account.tax'
+
+ _columns = {
+ 'group_id': fields.many2one('account.tax.group', 'Tax Group', help=("Choose the tax group"
+ "this is needed for example with magento or prestashop")),
+ }
+
+
=== added file 'base_sale_multichannels/account_view.xml'
--- base_sale_multichannels/account_view.xml 1970-01-01 00:00:00 +0000
+++ base_sale_multichannels/account_view.xml 2012-11-19 23:40:29 +0000
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data>
+
+ <record id="view_tax_form" model="ir.ui.view">
+ <field name="name">base_sale_multichannels.view_tax_form</field>
+ <field name="model">account.tax</field>
+ <field name="inherit_id" ref="account.view_tax_form" />
+ <field name="type">form</field>
+ <field name="arch" type="xml">
+ <field name="active" position="after">
+ <field name="group_id"/>
+ </field>
+ </field>
+ </record>
+
+
+ <record id="view_tax_group_tree" model="ir.ui.view">
+ <field name="name">account.tax.group</field>
+ <field name="model">account.tax.group</field>
+ <field name="type">tree</field>
+ <field name="arch" type="xml">
+ <tree string="Account Tax Group">
+ <field name="name"/>
+ <field name="tax_ids"/>
+ </tree>
+ </field>
+ </record>
+
+ <record id="view_tax_group_form" model="ir.ui.view">
+ <field name="name">account.tax.group</field>
+ <field name="model">account.tax.group</field>
+ <field name="type">form</field>
+ <field name="arch" type="xml">
+ <form string="Account Tax Group">
+ <field name="name" colspan="4"/>
+ <field name="tax_ids" colspan="4"/>
+ </form>
+ </field>
+ </record>
+
+ <record id="action_tax_group_form" model="ir.actions.act_window">
+ <field name="name">Tax Groups</field>
+ <field name="res_model">account.tax.group</field>
+ <field name="view_type">form</field>
+ <field name="view_mode">tree,form</field>
+ </record>
+
+ <menuitem action="action_tax_group_form" id="menu_action_tax_group_form" parent="account.next_id_27"/>
+
+ </data>
+</openerp>
=== modified file 'base_sale_multichannels/base_sale_data.xml'
--- base_sale_multichannels/base_sale_data.xml 2012-07-13 09:10:45 +0000
+++ base_sale_multichannels/base_sale_data.xml 2012-11-19 23:40:29 +0000
@@ -1,46 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
- <data noupdate="1">
+ <data noupdate="1">
<record id="product_categ_services" model="product.category">
<field name="name">Services</field>
</record>
- <record id="product_product_shipping" model="product.product">
- <field name="default_code">SHIP</field>
- <field name="list_price">0.0</field>
- <field name="standard_price">0.0</field>
- <field name="type">service</field>
- <field name="name">Shipping costs</field>
- <field name="categ_id" ref="product_categ_services"/>
- </record>
-
- <record id="product_product_cash_on_delivery" model="product.product">
- <field name="default_code">CASH ON DELIVERY</field>
- <field name="list_price">0.0</field>
- <field name="standard_price">0.0</field>
- <field name="type">service</field>
- <field name="name">Cash on delivery</field>
- <field name="categ_id" ref="product_categ_services"/>
- </record>
-
- <record id="product_product_gift" model="product.product">
- <field name="default_code">GIFT CERTIFICATE</field>
- <field name="list_price">0.0</field>
- <field name="standard_price">0.0</field>
- <field name="type">service</field>
- <field name="name">Gift Certificate</field>
- <field name="categ_id" ref="product_categ_services"/>
- </record>
-
- <record id="product_product_discount" model="product.product">
- <field name="default_code">DISCOUNT</field>
- <field name="list_price">0.0</field>
- <field name="standard_price">0.0</field>
- <field name="type">service</field>
- <field name="name">Discount Coupon</field>
- <field name="categ_id" ref="product_categ_services"/>
- </record>
-
- </data>
+ <record id="product_product_shipping" model="product.product">
+ <field name="default_code">SHIP</field>
+ <field name="list_price">0.0</field>
+ <field name="standard_price">0.0</field>
+ <field name="type">service</field>
+ <field name="name">Shipping costs</field>
+ <field name="categ_id" ref="product_categ_services"/>
+ </record>
+
+ <record id="product_product_cash_on_delivery" model="product.product">
+ <field name="default_code">CASH ON DELIVERY</field>
+ <field name="list_price">0.0</field>
+ <field name="standard_price">0.0</field>
+ <field name="type">service</field>
+ <field name="name">Cash on delivery</field>
+ <field name="categ_id" ref="product_categ_services"/>
+ </record>
+
+ <record id="product_product_gift" model="product.product">
+ <field name="default_code">GIFT CERTIFICATE</field>
+ <field name="list_price">0.0</field>
+ <field name="standard_price">0.0</field>
+ <field name="type">service</field>
+ <field name="name">Gift Certificate</field>
+ <field name="categ_id" ref="product_categ_services"/>
+ </record>
+
+ <record id="product_product_discount" model="product.product">
+ <field name="default_code">DISCOUNT</field>
+ <field name="list_price">0.0</field>
+ <field name="standard_price">0.0</field>
+ <field name="type">service</field>
+ <field name="name">Discount Coupon</field>
+ <field name="categ_id" ref="product_categ_services"/>
+ </record>
+
+ </data>
</openerp>
=== modified file 'base_sale_multichannels/delivery.py'
--- base_sale_multichannels/delivery.py 2011-07-14 14:37:48 +0000
+++ base_sale_multichannels/delivery.py 2012-11-19 23:40:29 +0000
@@ -18,14 +18,12 @@
#
##############################################################################
-from osv import fields, osv
-
-
-class delivery_carrier(osv.osv):
+from openerp.osv.orm import Model
+from openerp.osv import fields
+
+class delivery_carrier(Model):
_inherit = "delivery.carrier"
_columns = {
'export_needs_tracking': fields.boolean('Export only shippings with a tracking number'),
}
-
-delivery_carrier()
=== modified file 'base_sale_multichannels/external_referential.py'
--- base_sale_multichannels/external_referential.py 2012-06-01 17:46:16 +0000
+++ base_sale_multichannels/external_referential.py 2012-11-19 23:40:29 +0000
@@ -18,43 +18,46 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
# #
###############################################################################
-
-from osv import osv, fields
-#from base_external_referentials.external_osv import ExternalSesssion
-
-
-
-class external_referential(osv.osv):
+from openerp.osv.orm import Model
+from openerp.osv import fields
+
+
+class external_referential(Model):
_inherit = "external.referential"
_columns = {
- 'last_imported_product_id': fields.integer('Last Imported Product Id', help=("Product are imported one by one."
- "This is the magento id of the last product imported."
- "If you clear it all product will be imported")),
- 'last_imported_partner_id': fields.integer('Last Imported Partner Id', help=("Partners are imported one by one."
- "This is the magento id of the last partner imported."
- "If you clear it all partners will be imported")),
- 'import_all_attributs': fields.boolean('Import all attributs', help=("If the option is uncheck only the attributs"
- "that doesn't exist in OpenERP will be imported")),
- 'import_image_with_product': fields.boolean('With image', help=("If the option is check the product's image and"
- "the product will be imported at the same time and"
- "so the step '7-import images' is not needed")),
- 'import_links_with_product': fields.boolean('With links', help=("If the option is check the product's links"
- "(Up-Sell, Cross-Sell, Related) and the product will be imported"
- "at the same time and so the step '8-import links' is not needed")),
+ 'last_imported_product_id': fields.integer('Last Imported Product Id',
+ help=("Product are imported one by one."
+ "This is the magento id of the last product imported."
+ "If you clear it all product will be imported")),
+ 'last_imported_partner_id': fields.integer('Last Imported Partner Id',
+ help=("Partners are imported one by one."
+ "This is the magento id of the last partner imported."
+ "If you clear it all partners will be imported")),
+ 'import_all_attributs': fields.boolean('Import all attributs',
+ help=("If the option is uncheck only the attributs"
+ "that doesn't exist in OpenERP will be imported")),
+ 'import_image_with_product': fields.boolean('With image',
+ help=("If the option is check the product's image and"
+ "the product will be imported at the same time and"
+ "so the step '7-import images' is not needed")),
+ 'import_links_with_product': fields.boolean('With links',
+ help=("If the option is check the product's links"
+ "(Up-Sell, Cross-Sell, Related) and the product will be imported"
+ "at the same time and so the step '8-import links' is not needed")),
}
def import_customer_groups(self, cr, uid, ids, context=None):
- self.import_resources(cr, uid, ids, 'res.partner', context=context)
- return True
+ self.import_resources(cr, uid, ids, 'res.partner.category', context=context)
+ return True
def import_product_categories(self, cr, uid, ids, context=None):
self.import_resources(cr, uid, ids, 'product.category', context=context)
- return True
+ return True
def import_customers(self, cr, uid, ids, context=None):
self.import_resources(cr, uid, ids, 'res.partner', context=context)
- return True
+ return True
# def import_product_attributes_sets(self, cr, uid, ids, context=None):
# return self.import_resources(cr, uid, ids, 'TODO', context=context)
@@ -67,16 +70,11 @@
def import_products(self, cr, uid, ids, context=None):
self.import_resources(cr, uid, ids, 'product.product', context=context)
- return True
-
-#If we want to support that feature we need to add a dependancy on product_images_olbs
- def import_product_images(self, cr, uid, ids, context=None):
- self.import_resources(cr, uid, ids, 'product.image', context=context)
- return True
+ return True
def import_product_links(self, cr, uid, ids, context=None):
self.import_resources(cr, uid, ids, 'product.link', context=context)
- return True
+ return True
=== removed file 'base_sale_multichannels/external_referential_view.xml'
--- base_sale_multichannels/external_referential_view.xml 2012-06-21 17:44:12 +0000
+++ base_sale_multichannels/external_referential_view.xml 1970-01-01 00:00:00 +0000
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<openerp>
- <data>
- <!-- E-commerce Referentials Tree/Form view -->
-
- <record id="external_referential_form_view" model="ir.ui.view">
- <field name="name">base_sale_mulitchannels.external_referential_form_view</field>
- <field name="model">external.referential</field>
- <field name="inherit_id" ref="base_external_referentials.external_referential_form_view" />
- <field name="type">form</field>
- <field name="arch" type="xml">
- <xpath expr="/form/group/notebook/page/button[@name='import_referentials']" position="after">
- <group colspan="4" attrs="{'invisible':[('categ_name','!=','Multichannel Sale')]}">
- <separator string="Optional - Initial import only" colspan="4" />
- <group name='left' colspan="2" col="2">
- <button name="import_customer_groups" string="1 - Import Customer Groups (Partner Categories)" colspan="2" type="object" />
- <button name="import_customers" string="1 - Import Customer" colspan="2" type="object" />
- <button name="import_product_categories" string="2 - Import Product Categories" colspan="2" type="object" />
- <button name="import_product_attributes_sets" string="3 - Import Product Attribute Sets" colspan="2" type="object" />
- <button name="import_product_attributes_groups" string="4 - Import Attribute Groups" colspan="2" type="object" />
- </group>
- <group name="right" colspan="2" col="2">
- <group colspan="2" col="12">
- <button name="import_product_attributes" string="5 - Import Product Attributes" colspan="10" type="object" />
- <!-- <field name="import_all_attributs"/> -->
- </group>
- <group colspan="2" col="14">
- <group colspan="8">
- <button name="import_products" string="6 - Import Products" type="object" attrs="{'invisible':[('import_image_with_product','=',True)]}" />
- <button name="import_products" string="6 - Import Products And Images" type="object" attrs="{'invisible':[('import_image_with_product','=',False)]}" />
- </group>
- <field name="import_image_with_product"/>
- <field name="import_links_with_product"/>
- <field name="last_imported_product_id" string=""/>
- </group>
- <button name="import_product_images" string="7 - Import Images" colspan="2" type="object" attrs="{'invisible':[('import_image_with_product','=',True)]}"/>
- <button name="import_product_links" string="8 - Import Product Links" colspan="2" type="object" />
- </group>
- <!-- <separator string="Default values" colspan="4" />
- <field name="default_pro_cat" required="1"/>
- <field name="default_lang_id" required="1"/>
- -->
- <!-- <button name="sync_customer_addresses" string="Sync Customer Addresses" colspan="2" type="object" />-->
- <!-- <button name="export_products" string="Export Products" colspan="2" type="object" />-->
- </group>
- </xpath>
-
- </field>
- </record>
-
- </data>
-</openerp>
=== modified file 'base_sale_multichannels/invoice.py'
--- base_sale_multichannels/invoice.py 2012-06-01 17:46:16 +0000
+++ base_sale_multichannels/invoice.py 2012-11-19 23:40:29 +0000
@@ -18,10 +18,10 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
# #
###############################################################################
-from osv import osv, fields
-import os
+from openerp.osv.orm import Model
+from openerp.osv import fields
-class account_invoice(osv.osv):
+class account_invoice(Model):
_inherit='account.invoice'
_columns={
=== removed file 'base_sale_multichannels/ir_module.py'
--- base_sale_multichannels/ir_module.py 2011-12-14 09:47:43 +0000
+++ base_sale_multichannels/ir_module.py 1970-01-01 00:00:00 +0000
@@ -1,15 +0,0 @@
-# FIXME: TO REMOVE ONCE (IF) MERGED IN SERVER
-
-from osv import osv
-
-
-class ir_module_module(osv.osv):
-
- _inherit = 'ir.module.module'
-
- def is_installed(self, cr, uid, module_name, context=None):
- if self.search(cr, 1, [['name', '=', module_name], ['state', 'in', ['installed', 'to upgrade']]], context=context):
- return True
- return False
-
-ir_module_module()
=== modified file 'base_sale_multichannels/partner.py'
--- base_sale_multichannels/partner.py 2012-08-21 05:27:25 +0000
+++ base_sale_multichannels/partner.py 2012-11-19 23:40:29 +0000
@@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
#################################################################################
# #
-# amazonerpconnect for OpenERP #
+# base_sale_multichannels for OpenERP #
# Copyright (C) 2011 Akretion Sébastien BEAU <sebastien.beau@xxxxxxxxxxxx> #
# #
# This program is free software: you can redistribute it and/or modify #
@@ -19,30 +19,34 @@
# #
#################################################################################
-from osv import osv, fields
-
-class res_partner(osv.osv):
+from openerp.osv.orm import Model
+from openerp.osv import fields
+
+
+class res_partner(Model):
_inherit='res.partner'
-
+
_columns = {
+ # defaults_shop_id is deprecated... we should not use it any more !
'defaults_shop_id': fields.many2one('sale.shop', 'Sale Shop', help="This is the default shop of the customer"),
+ 'shop_ids': fields.many2many('sale.shop', 'sale_shop_res_partner_rel', 'shop_id', 'partner_id', 'Present in Shops', readonly=True, help="List of shops in which this customer exists."),
}
-
+
def _get_default_import_values(self, cr, uid, external_session, mapping_id=None, defaults=None, context=None):
- shop_id = context.get('sale_shop_id')
- if shop_id:
- shop = self.pool.get('sale.shop').browse(cr, uid, shop_id, context=context)
+ if external_session.sync_from_object._name == 'sale.shop':
+ shop = external_session.sync_from_object
if not defaults: defaults = {}
defaults.update({
- 'lang': shop.default_customer_lang.id
+ 'lang': shop.default_customer_lang.code,
+ 'property_account_position': shop.default_fiscal_position.id,
+ 'property_account_receivable': shop.default_customer_account,
+ 'shop_ids': [(4, shop.id)],
})
return defaults
-res_partner()
-
-class res_partner_address(osv.osv):
+class res_partner_address(Model):
_inherit='res.partner.address'
-
+
def _transform_one_resource(self, *args, **kwargs):
if kwargs.get('parent_data') and kwargs['parent_data'].get('partner_id'):
kwargs['defaults']['partner_id'] = kwargs['parent_data']['parent_id']
=== added file 'base_sale_multichannels/partner_view.xml'
--- base_sale_multichannels/partner_view.xml 1970-01-01 00:00:00 +0000
+++ base_sale_multichannels/partner_view.xml 2012-11-19 23:40:29 +0000
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+ Copyright (C) 2012 Akretion (http://www.akretion.com/)
+ @author Alexis de Lattre <alexis.delattre@xxxxxxxxxxxx>
+ The licence is in the file __openerp__.py
+-->
+
+<openerp>
+<data>
+
+
+<record id="shop_ids_partner_form" model="ir.ui.view">
+ <field name="name">shop_ids.partner.form</field>
+ <field name="model">res.partner</field>
+ <field name="inherit_id" ref="base.view_partner_form" />
+ <field name="arch" type="xml">
+ <page string="History" position="after">
+ <page string="Shops">
+ <field name="shop_ids" nolabel="1" colspan="4" />
+ </page>
+ </page>
+ </field>
+</record>
+
+
+</data>
+</openerp>
=== modified file 'base_sale_multichannels/payment_method.py'
--- base_sale_multichannels/payment_method.py 2012-07-19 17:30:22 +0000
+++ base_sale_multichannels/payment_method.py 2012-11-19 23:40:29 +0000
@@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
#################################################################################
# #
-# sale_automatic_workflow for OpenERP #
+# base_sale_multichannels for OpenERP #
# Copyright (C) 2011 Akretion Sébastien BEAU <sebastien.beau@xxxxxxxxxxxx> #
# #
# This program is free software: you can redistribute it and/or modify #
@@ -20,11 +20,12 @@
#################################################################################
-from osv import osv, fields
-import netsvc
-
-
-class payment_method(osv.osv):
+from openerp.osv.orm import Model
+from openerp.osv import fields
+
+
+
+class payment_method(Model):
_inherit = "payment.method"
_columns = {
=== modified file 'base_sale_multichannels/product.py'
--- base_sale_multichannels/product.py 2012-09-05 16:16:15 +0000
+++ base_sale_multichannels/product.py 2012-11-19 23:40:29 +0000
@@ -20,10 +20,12 @@
###############################################################################
-from osv import osv, fields
-from base_external_referentials.decorator import only_for_referential, commit_now
+from openerp.osv.orm import Model
+from openerp.osv import fields
+from base_external_referentials.decorator import only_for_referential
+from base_external_referentials.decorator import commit_now
-class product_product(osv.osv):
+class product_product(Model):
_inherit='product.product'
def _check_if_export(self, cr, uid, external_session, product, context=None):
@@ -64,9 +66,55 @@
res = (), {} # list of ids, dict of ids to date_changed
return res
-class product_category(osv.osv):
+
+ def _get_categories_ids_for_shop(self, cr, uid, product_id, shop_id, context=None):
+ shop_categ_ids = self.pool.get('sale.shop').read(cr, uid, shop_id,
+ ['exportable_category_ids'],
+ context=context)['exportable_category_ids']
+ product = self.read(cr, uid, product_id, ['categ_ids', 'categ_id'], context=context)
+ product_categ_ids = product['categ_ids']
+ if product['categ_id'][0] not in product_categ_ids:
+ product_categ_ids.append(product['categ_id'][0])
+ res = []
+ for categ in product_categ_ids:
+ if categ in shop_categ_ids:
+ res.append(categ)
+ return res
+
+
+ def _get_or_create_ext_category_ids_for_shop(self, cr, uid, external_session, product_id, context=None):
+ res = []
+ categ_obj = self.pool.get('product.category')
+ for oe_categ_id in self._get_categories_ids_for_shop(cr, uid, product_id, external_session.sync_from_object.id, context=context):
+ res.append(categ_obj.get_or_create_extid(cr, uid, external_session, oe_categ_id, context=context))
+ return res
+
+
+
+class product_template(Model):
+ _inherit = 'product.template'
+
+ #TODO implement set function and also support multi tax
+ def _get_tax_group_id(self, cr, uid, ids, field_name, args, context=None):
+ result = {}
+ for product in self.browse(cr, uid, ids, context=context):
+ result[product.id] = product.taxes_id and product.taxes_id[0].group_id.id
+ return result
+
+ _columns = {
+ 'tax_group_id': fields.function(_get_tax_group_id,
+ string='Tax Group',
+ type='many2one',
+ relation='account.tax.group',
+ store=False,
+ help=('Tax group are use with some external',
+ 'system like magento or prestashop')),
+ }
+
+
+class product_category(Model):
_inherit = "product.category"
-
+
def collect_children(self, category, children=None):
if children is None:
children = []
@@ -76,7 +124,7 @@
self.collect_children(child, children)
return children
-
+
def _get_recursive_children_ids(self, cr, uid, ids, name, args, context=None):
res = {}
for category in self.browse(cr, uid, ids):
@@ -101,7 +149,7 @@
shop = self.pool.get('sale.shop').browse(cr, uid, context['sale_shop_id'],context=context)
if shop.exportable_category_ids:
res = super(product_category, self).get_ids_and_update_date(cr, uid, external_session,
- ids=[product.id for product in shop.exportable_category_ids],
+ ids=[categ.id for categ in shop.exportable_category_ids],
last_exported_date=last_exported_date,
context=context)
else:
=== removed file 'base_sale_multichannels/report.py'
--- base_sale_multichannels/report.py 2012-08-21 09:16:01 +0000
+++ base_sale_multichannels/report.py 1970-01-01 00:00:00 +0000
@@ -1,49 +0,0 @@
-# -*- encoding: utf-8 -*-
-##############################################################################
-#
-# Author Guewen Baconnier. Copyright Camptocamp SA
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-##############################################################################
-
-from osv import osv, fields
-from tools.translate import _
-
-
-class external_report(osv.osv):
- _inherit = 'external.report'
-
- _columns = {
- 'shop_id': fields.many2one('sale.shop', 'Shop', readonly=True),
- }
-
- def get_report_filter(self, cr, uid, ref, external_referential_id,
- name=None, context=None):
- filter = super(external_report, self).get_report_filter(cr, uid, ref,
- external_referential_id, name=name,
- context=context)
- filter.append(('shop_id', '=', context.get('shop_id', False)))
- return filter
-
- def _prepare_start_report(self, cr, uid, method, object, context=None):
- res = super(external_report, self)._prepare_start_report(
- cr, uid, method, object, context=context)
- if context is None: context = {}
- if not context.get('shop_id'):
- raise Exception('Missing shop_id while creating a synchronisation report')
- res['shop_id'] = context['shop_id']
- return res
-
-external_report()
=== removed file 'base_sale_multichannels/report_view.xml'
--- base_sale_multichannels/report_view.xml 2012-02-27 18:19:32 +0000
+++ base_sale_multichannels/report_view.xml 1970-01-01 00:00:00 +0000
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<openerp>
- <data>
-
- <record model="ir.ui.view" id="external_report_form_view_shop">
- <field name="name">external_report_form_view_shop</field>
- <field name="model">external.report</field>
- <field name="inherit_id" ref="base_external_referentials.external_report_form_view" />
- <field name="type">form</field>
- <field name="arch" type="xml">
- <field name="external_referential_id" position="after">
- <field name="shop_id"/>
- </field>
- </field>
- </record>
-
- <record model="ir.ui.view" id="external_report_tree_view_shop">
- <field name="name">external_report_tree_view_shop</field>
- <field name="model">external.report</field>
- <field name="inherit_id" ref="base_external_referentials.external_report_tree_view" />
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <field name="external_referential_id" position="after">
- <field name="shop_id"/>
- </field>
- </field>
- </record>
-
- <record model="ir.ui.view" id="external_report_search_form_view_shop">
- <field name="name">external_report_form_view_shop</field>
- <field name="model">external.report</field>
- <field name="inherit_id" ref="base_external_referentials.external_report_search_form_view" />
- <field name="type">search</field>
- <field name="arch" type="xml">
- <filter string='External Referential' position="after">
- <filter string='Shop' icon="terp-stock_symbol-selection" domain="[]" context="{'group_by' : 'shop_id'}" />
- </filter>
- </field>
- </record>
-
- </data>
-</openerp>
=== modified file 'base_sale_multichannels/sale.py'
--- base_sale_multichannels/sale.py 2012-11-19 13:22:31 +0000
+++ base_sale_multichannels/sale.py 2012-11-19 23:40:29 +0000
@@ -1,4 +1,4 @@
- # -*- encoding: utf-8 -*-
+# -*- encoding: utf-8 -*-
#########################################################################
# #
# Copyright (C) 2009 Raphaël Valyi #
@@ -21,7 +21,9 @@
#along with this program. If not, see <http://www.gnu.org/licenses/>. #
#########################################################################
-from osv import osv, fields
+from openerp.osv.orm import Model
+from openerp.osv import fields
+from openerp.osv.osv import except_osv
import pooler
from sets import Set as set
import netsvc
@@ -40,7 +42,7 @@
_logger = logging.getLogger(__name__)
-class StockPicking(osv.osv):
+class StockPicking(Model):
'''Add a flag for marking picking as exported'''
_inherit = 'stock.picking'
@@ -49,15 +51,15 @@
readonly=True),
}
-StockPicking()
-class external_shop_group(osv.osv):
+class external_shop_group(Model):
_name = 'external.shop.group'
_description = 'External Referential Shop Group'
_columns = {
'name': fields.char('Name', size=64, required=True),
- 'referential_id': fields.many2one('external.referential', 'Referential', select=True, ondelete='cascade'),
+ 'referential_id': fields.many2one('external.referential', 'Referential', select=True,
+ ondelete='cascade'),
'shop_ids': fields.one2many('sale.shop', 'shop_group_id', 'Sale Shops'),
}
@@ -65,17 +67,14 @@
def _get_default_import_values(self, cr, uid, external_session, **kwargs):
return {'referential_id' : external_session.referential_id.id}
-external_shop_group()
-
-
-class external_referential(osv.osv):
+
+class external_referential(Model):
_inherit = 'external.referential'
_columns = {
'shop_group_ids': fields.one2many('external.shop.group', 'referential_id', 'Sub Entities'),
}
-external_referential()
class ExternalShippingCreateError(Exception):
@@ -88,7 +87,7 @@
pass
-class sale_shop(osv.osv):
+class sale_shop(Model):
_inherit = "sale.shop"
def _get_exportable_category_ids(self, cr, uid, ids, name, args, context=None):
@@ -102,19 +101,19 @@
def _get_exportable_product_ids(self, cr, uid, ids, name, args, context=None):
res = {}
- for shop in self.browse(cr, uid, ids, context=context):
- root_categories = [category for category in shop.exportable_root_category_ids]
- all_categories = []
- for category in root_categories:
- all_categories += [category.id for category in category.recursive_children_ids]
+ for shop in self.read(cr, uid, ids, ['exportable_category_ids'], context=context):
+ all_categories = shop['exportable_category_ids']
- # If product_m2mcategories module is installed search in main category and extra categories. If not, only in main category
- cr.execute('select * from ir_module_module where name=%s and state=%s', ('product_m2mcategories','installed'))
+ # If product_m2mcategories module is installed search in main category
+ # and extra categories. If not, only in main category
+ cr.execute('select * from ir_module_module where name=%s and state=%s',
+ ('product_m2mcategories','installed'))
if cr.fetchone():
- product_ids = self.pool.get("product.product").search(cr, uid, ['|',('categ_id', 'in', all_categories),('categ_ids', 'in', all_categories)])
+ res[shop['id']] = self.pool.get("product.product").search(cr, uid, ['|',
+ ('categ_id', 'in', all_categories),('categ_ids', 'in', all_categories)])
else:
- product_ids = self.pool.get("product.product").search(cr, uid, [('categ_id', 'in', all_categories)])
- res[shop.id] = product_ids
+ res[shop['id']] = self.pool.get("product.product").search(cr, uid,
+ [('categ_id', 'in', all_categories)])
return res
def _get_referential_id(self, cr, uid, ids, name, args, context=None):
@@ -126,15 +125,15 @@
res[shop.id] = shop.referential_integer_id
return res
+ def _get_shop_from_shop_group(self, cr, uid, ids, context=None):
+ return self.pool.get('sale.shop').search(cr, uid, [('shop_group_id', 'in', ids)], context=context)
+
def _set_referential_id(self, cr, uid, id, name, value, arg, context=None):
shop = self.browse(cr, uid, id, context=context)
if shop.shop_group_id:
- raise osv.except_osv(_("User Error"), _("You can not change the referential of this shop, please change the referential of the shop group!"))
+ raise except_osv(_("User Error"), _("You can not change the referential of this shop, please change the referential of the shop group!"))
else:
- if value == False:
- cr.execute('update sale_shop set referential_integer_id = NULL where id=%s', (id,))
- else:
- cr.execute('update sale_shop set referential_integer_id = %s where id=%s', (value, id))
+ self.write(cr, uid, id, {'referential_integer_id': value}, context=context)
return True
def _get_shop_ids(self, cr, uid, ids, context=None):
@@ -144,9 +143,10 @@
return shop_ids
def _get_stock_field_id(self, cr, uid, context=None):
- # TODO : Hidden dependency, put in a glue module ?
- if self.pool.get('ir.module.module').is_installed(
- cr, uid, 'stock_available_immediately', context=None):
+ if self.pool.get('ir.module.module').search(cr, uid, [
+ ['name', '=', 'stock_available_immediately'],
+ ['state', 'in', ['installed', 'to upgrade']],
+ ], context=context):
stock_field = 'immediately_usable_qty'
else:
stock_field = 'virtual_available'
@@ -169,11 +169,20 @@
def _set_rootcategory(self, cr, uid, id, name, value, fnct_inv_arg, context=None):
return self.write(cr, uid, id, {'exportable_root_category_ids': [(6,0,[value])]}, context=context)
+ def _get_referential_type_name(self, cr, uid, ids, field_name, arg, context=None):
+ result = {}
+ for shop in self.browse(cr, uid, ids):
+ if shop.referential_id:
+ result[shop.id] = shop.referential_id.type_id.name
+ else:
+ result[shop.id] = False
+ return result
+
_columns = {
- 'exportable_category_ids': fields.function(_get_exportable_category_ids, method=True, type='one2many', relation="product.category", string='Exportable Categories'),
+ 'exportable_category_ids': fields.function(_get_exportable_category_ids, type='many2many', relation="product.category", string='Exportable Categories'),
'exportable_root_category_ids': fields.many2many('product.category', 'shop_category_rel', 'categ_id', 'shop_id', 'Exportable Root Categories'),
'exportable_root_category_id':fields.function(_get_rootcategory, fnct_inv = _set_rootcategory, type="many2one", relation="product.category", string="Root Category"),
- 'exportable_product_ids': fields.function(_get_exportable_product_ids, method=True, type='one2many', relation="product.product", string='Exportable Products'),
+ 'exportable_product_ids': fields.function(_get_exportable_product_ids, type='many2many', relation="product.product", string='Exportable Products'),
'shop_group_id': fields.many2one('external.shop.group', 'Shop Group', ondelete='cascade'),
'last_inventory_export_date': fields.datetime('Last Inventory Export Time'),
'last_images_export_date': fields.datetime('Last Images Export Time'),
@@ -181,8 +190,12 @@
'last_products_export_date' : fields.datetime('Last Product Export Time'),
'last_special_products_export_date' : fields.datetime('Last Special Product Export Time'),
'last_category_export_date' : fields.datetime('Last Category Export Time'),
- 'referential_id': fields.function(_get_referential_id, fnct_inv = _set_referential_id, type='many2one',
- relation='external.referential', string='External Referential'),
+ 'referential_id': fields.function(_get_referential_id,
+ fnct_inv=_set_referential_id, type='many2one',
+ relation='external.referential', string='External Referential', store={
+ 'sale.shop': (lambda self, cr, uid, ids, c={}: ids, ['referential_integer_id', 'shop_group_id'], 10),
+ 'external.shop.group': (_get_shop_from_shop_group, ['referential_id'], 20),
+ }),
'referential_integer_id': fields.integer('Referential Integer ID'),
'is_tax_included': fields.boolean('Prices Include Tax', help="Does the external system work with Taxes Inclusive Prices ?"),
'sale_journal': fields.many2one('account.journal', 'Sale Journal'),
@@ -203,7 +216,9 @@
"according to default values and fiscal positions."),
'import_orders_from_date': fields.datetime('Only created after'),
'check_total_amount': fields.boolean('Check Total Amount', help="The total amount computed by OpenERP should match with the external amount, if not the sale order can not be confirmed."),
- 'type_id': fields.related('referential_id', 'type_id', type='many2one', relation='external.referential.type', string='External Type'),
+ 'type_name': fields.function(_get_referential_type_name, type='char', string='Referential type',
+ store={
+ 'sale.shop': (lambda self, cr, uid, ids, c={}: ids, ['referential_id', 'shop_group_id'],10)}),
'product_stock_field_id': fields.many2one(
'ir.model.fields',
string='Stock Field',
@@ -215,9 +230,9 @@
}
_defaults = {
- 'payment_default_id': lambda * a: 1, #required field that would cause trouble if not set when importing
- 'auto_import': lambda * a: True,
- 'use_external_tax': lambda * a: True,
+ 'payment_default_id': 1, #required field that would cause trouble if not set when importing
+ 'auto_import': True,
+ 'use_external_tax': True,
'product_stock_field_id': _get_stock_field_id,
}
@@ -259,13 +274,22 @@
def export_inventory(self, cr, uid, ids, context=None):
if context is None:
context = {}
-
+ for shop in self.browse(cr, uid, ids):
+ external_session = ExternalSession(shop.referential_id, shop)
+ self._export_inventory(cr, uid, external_session, ids, context=context)
+ return True
+
+ def _get_product_ids_for_stock_to_export(self, cr, uid, shop, context=None):
+ return [product.id for product in shop.exportable_product_ids]
+
+ def _export_inventory(self, cr, uid, external_session, ids, context=None):
+ shop = external_session.sync_from_object
stock_move_obj = self.pool.get('stock.move')
for shop in self.browse(cr, uid, ids):
external_session = ExternalSession(shop.referential_id, shop)
- product_ids = [product.id for product
- in shop.exportable_product_ids]
+ product_ids = self._get_product_ids_for_stock_to_export(cr, uid, shop, context=context)
+
if shop.last_inventory_export_date:
# we do not exclude canceled moves because it means
# some stock levels could have increased since last export
@@ -273,6 +297,7 @@
cr, uid,
[('write_date', '>', shop.last_inventory_export_date),
('product_id', 'in', product_ids),
+ ('product_id.type', '!=', 'service'),
('state', '!=', 'draft')],
context=context)
else:
@@ -298,7 +323,7 @@
def import_catalog(self, cr, uid, ids, context):
#TODO import categories, then products
- raise osv.except_osv(_("Not Implemented"), _("Not Implemented in abstract base module!"))
+ raise except_osv(_("Not Implemented"), _("Not Implemented in abstract base module!"))
def import_orders(self, cr, uid, ids, context=None):
self.import_resources(cr, uid, ids, 'sale.order', context=context)
@@ -357,7 +382,7 @@
return True
def update_shop_orders(self, cr, uid, external_session, order, ext_id, context):
- raise osv.except_osv(_("Not Implemented"), _("Not Implemented in abstract base module!"))
+ raise except_osv(_("Not Implemented"), _("Not Implemented in abstract base module!"))
def _export_shipping_query(self, cr, uid, shop, context=None):
query = """
@@ -480,11 +505,9 @@
sale_shop()
-class sale_order(osv.osv):
+class sale_order(Model):
_inherit = "sale.order"
- _order = 'date_order desc, name desc'
-
_columns = {
'need_to_update': fields.boolean('Need To Update'),
'ext_total_amount': fields.float(
@@ -502,7 +525,7 @@
}
_defaults = {
- 'need_to_update': lambda *a: False,
+ 'need_to_update': False,
}
def write(self, cr, uid, ids, vals, context=None):
@@ -511,10 +534,13 @@
return super(sale_order, self).write(cr, uid, ids, vals, context=context)
def _get_default_import_values(self, cr, uid, external_session, mapping_id=None, defaults=None, context=None):
- shop_id = context.get('sale_shop_id')
- if shop_id:
- shop = self.pool.get('sale.shop').browse(cr, uid, shop_id, context=context)
- if not defaults: defaults = {}
+ shop = False
+ if external_session.sync_from_object._name == 'sale.shop':
+ shop = external_session.sync_from_object
+ elif context.get('sale_shop_id'):
+ shop = self.pool.get('sale.shop').browse(cr, uid, context['sale_shop_id'], context=context)
+ if shop:
+ if defaults is None: defaults = {}
defaults.update({
'pricelist_id': shop.get_pricelist(context=context),
'shop_id': shop.id,
@@ -522,6 +548,13 @@
'payment_method_id': shop.default_payment_method_id.id,
'company_id': shop.company_id.id,
})
+ #TODO we should avoid passing this parameter in the context
+ #for now we new it for importing order from wizard correctly
+ #refactor for V7
+ context.update({
+ 'use_external_tax': shop.use_external_tax,
+ 'is_tax_included': shop.is_tax_included,
+ })
return defaults
@open_report
@@ -584,27 +617,38 @@
"""Not implemented in this abstract module"""
return True
- def _get_kwargs_onchange_partner_id(self, cr, uid, vals, context=None):
- return {
- 'ids': None,
- 'part': vals.get('partner_id'),
- }
-
+ def _get_params_onchange_partner_id(self, cr, uid, vals, context=None):
+ args = [
+ 'None',
+ vals.get('partner_id'),
+ ]
+ return args, {}
#I will probably extract this code in order to put it in a "glue" module
- def _get_kwargs_onchange_partner_invoice_id(self, cr, uid, vals, context=None):
- return {
- 'ids': None,
- 'partner_invoice_id': vals.get('partner_invoice_id'),
- 'partner_id': vals.get('partner_id'),
+ def _get_params_onchange_address_id(self, cr, uid, vals, context=None):
+ args = [
+ None,
+ vals.get('partner_invoice_id'),
+ vals.get('partner_shipping_id'),
+ vals.get('partner_id'),
+ ]
+ kwargs = {
'shop_id': vals.get('shop_id'),
}
+ return args, kwargs
def play_sale_order_onchange(self, cr, uid, vals, defaults=None, context=None):
ir_module_obj= self.pool.get('ir.module.module')
- vals = self.call_onchange(cr, uid, 'onchange_partner_id', vals, defaults, context=context)
- if ir_module_obj.is_installed(cr, uid, 'account_fiscal_position_rule_sale', context=context):
- vals = self.call_onchange(cr, uid, 'onchange_partner_invoice_id', vals, defaults, context=context)
+ if ir_module_obj.search(cr, uid, [
+ ['name', '=', 'account_fiscal_position_rule_sale'],
+ ['state', 'in', ['installed', 'to upgrade']],
+ ], context=context):
+ vals = self.call_onchange(cr, uid, 'onchange_partner_id', vals, defaults, context=context)
+ vals = self.call_onchange(cr, uid, 'onchange_address_id', vals, defaults, context=context)
+ else:
+ vals = self.call_onchange(cr, uid, 'onchange_partner_id', vals, defaults, context=context)
+
+
return vals
def _merge_with_default_values(self, cr, uid, external_session, ressource, vals, sub_mapping_list, defaults=None, context=None):
@@ -629,6 +673,8 @@
vals = self._convert_special_fields(cr, uid, vals, external_session.referential_id.id, context=context)
if not vals.get('partner_order_id'):
vals['partner_order_id'] = vals['partner_invoice_id']
+ if not vals.get('partner_shipping_id'):
+ vals['partner_shipping_id'] = vals['partner_invoice_id']
order_id = super(sale_order, self).oe_create(cr, uid, external_session, vals, resource, defaults, context)
self.paid_and_update(cr, uid, external_session, order_id, resource, context=context)
return order_id
@@ -720,8 +766,8 @@
# It's better to don't allow this feature to avoid hidding a problem.
# It's better to have the order not imported and to know it than having order with duplicated line.
if not (context and context.get('oe_update_supported', False)):
- #TODO found a clean solution to raise the osv.except_osv error in the try except of the function import_with_try
- raise osv.except_osv(_("Not Implemented"), _(("The order with the id %s try to be updated from the external system."
+ #TODO found a clean solution to raise the except_osv error in the try except of the function import_with_try
+ raise except_osv(_("Not Implemented"), _(("The order with the id %s try to be updated from the external system."
" This feature is not supported. Maybe the import try to reimport an existing sale order"%(existing_rec_id,))))
return super(sale_order, self).oe_update(cr, uid, external_session, existing_rec_id, vals, resource, defaults, context=context)
@@ -824,7 +870,7 @@
if tax_rate:
line_tax_id = self.pool.get('account.tax').get_tax_from_rate(cr, uid, tax_rate, context.get('is_tax_included'), context=context)
if not line_tax_id:
- raise osv.except_osv(_('Error'), _('No tax id found for the rate %s with the tax include = %s')%(tax_rate, context.get('is_tax_included')))
+ raise except_osv(_('Error'), _('No tax id found for the rate %s with the tax include = %s')%(tax_rate, context.get('is_tax_included')))
extra_line['tax_id'] = [(6, 0, [line_tax_id])]
ext_code_field = option.get('code_field')
@@ -833,24 +879,36 @@
vals['order_line'].append((0, 0, extra_line))
return vals
-sale_order()
-
-
-class sale_order_line(osv.osv):
+ def reimport_order_from_external_referential(self, cr, uid, ids, context=None):
+ if context is None: context = {}
+ for sale_order in self.browse(cr, uid, ids, context=context):
+ shop = sale_order.shop_id
+ sale_ext_id = sale_order.get_extid(shop.referential_id.id, context=context)
+ sale_order.unlink()
+ external_session = ExternalSession(shop.referential_id, shop)
+ self.pool.get('sale.order')._import_one_resource(cr, uid, external_session, sale_ext_id, context=context)
+ return True
+
+class sale_order_line(Model):
_inherit='sale.order.line'
_columns = {
- 'ext_product_ref': fields.char('Product Ext Ref', help="This is the original external product reference", size=256),
+ 'ext_product_ref': fields.char('Product Ext Ref',
+ help="This is the original external product reference", size=256),
'shipping_tax_amount': fields.dummy(string = 'Shipping Taxe Amount'),
'shipping_amount_tax_excluded': fields.dummy(string = 'Shipping Price Tax Exclude'),
'shipping_amount_tax_included': fields.dummy(string = 'Shipping Price Tax Include'),
+ 'ext_ref_line': fields.char('Ext. Ref Line', size=64,
+ help='Unique order line id delivered by external application'),
}
- def _get_kwargs_product_id_change(self, cr, uid, line, parent_data, previous_lines, context=None):
- return {
- 'ids': None,
- 'pricelist': parent_data.get('pricelist_id'),
- 'product': line.get('product_id'),
+ def _get_params_product_id_change(self, cr, uid, line, parent_data, previous_lines, context=None):
+ args = [
+ None,
+ parent_data.get('pricelist_id'),
+ line.get('product_id')
+ ]
+ kwargs ={
'qty': float(line.get('product_uom_qty')),
'uom': line.get('product_uom'),
'qty_uos': float(line.get('product_uos_qty') or line.get('product_uom_qty')),
@@ -865,6 +923,7 @@
'flag': False,
'context': context,
}
+ return args, kwargs
def play_sale_order_line_onchange(self, cr, uid, line, parent_data, previous_lines, defaults=None, context=None):
line = self.call_onchange(cr, uid, 'product_id_change', line, defaults=defaults, parent_data=parent_data, previous_lines=previous_lines, context=context)
@@ -885,15 +944,15 @@
elif 'price_unit_tax_excluded' in line:
line['price_unit'] = line['price_unit_tax_excluded']
- line = self.play_sale_order_line_onchange(cr, uid, line, parent_data, previous_result, defaults, context=context)
+ line = self.play_sale_order_line_onchange(cr, uid, line, parent_data, previous_result,
+ defaults, context=context)
if context.get('use_external_tax'):
if line.get('tax_rate'):
line_tax_id = self.pool.get('account.tax').get_tax_from_rate(cr, uid, line['tax_rate'], context.get('is_tax_included', False), context=context)
if not line_tax_id:
- raise osv.except_osv(_('Error'), _('No tax id found for the rate %s with the tax include = %s')%(line['tax_rate'], context.get('is_tax_included')))
+ raise except_osv(_('Error'), _('No tax id found for the rate %s with the tax include = %s')%(line['tax_rate'], context.get('is_tax_included')))
line['tax_id'] = [(6, 0, [line_tax_id])]
return line
-sale_order_line()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== modified file 'base_sale_multichannels/sale_view.xml'
--- base_sale_multichannels/sale_view.xml 2012-08-21 05:27:25 +0000
+++ base_sale_multichannels/sale_view.xml 2012-11-19 23:40:29 +0000
@@ -15,39 +15,6 @@
<form position="inside">
<separator string="Sale Multi Channels" colspan="4" />
<notebook colspan="4">
- <page string="Actions">
- <group col="6" colspan="4">
- <group col="3" colspan="3">
- <separator string="Catalog" colspan="3"/>
- <group col="1" colspan="1">
- <button name="export_catalog" string="Export Catalog" colspan="1" type="object"/>
- <button name="export_inventory" string="Export Stock Levels Only" colspan="1" type="object"/>
- </group>
- <group col="2" colspan="2">
- <field name="last_products_export_date" colspan="2"/>
- <field name="last_special_products_export_date" colspan="2"/>
- <field name="last_category_export_date" colspan="2"/>
- <field name="last_inventory_export_date" colspan="2"/>
- </group>
- </group>
- <group col="3" colspan="3">
- <separator string="Orders" colspan="3"/>
- <group col="4" colspan="3">
- <button name="import_orders" string="Import Orders" colspan="1" type="object"/>
- <button name="check_need_to_update" string="Check Payments from Channel" colspan="1" type="object"/>
- <field name="import_orders_from_date" colspan="2"/>
- </group>
- <button name="update_orders" string="Update Orders State on Channel" colspan="1" type="object"/>
- <field name="last_update_order_export_date" colspan="2"/>
- <button name="export_invoices" string="Export Invoices" colspan="1" type="object"/>
- <button name="export_shipping" string="Export Shippings" colspan="1" type="object"/>
- </group>
- <separator string="Partners" colspan="3"/>
- <newline/>
- <button name="export_shop_partners" string="Export Partners" colspan="1" type="object"/>
- <newline/>
- </group>
- </page>
<page string="External Shop Settings">
<group col="4" colspan="4">
<field name="referential_id" />
@@ -68,8 +35,8 @@
<separator string='Stock' colspan="4"/>
<field name="product_stock_field_id"/>
<separator string='Other Information' colspan="4"/>
- <field name="address_id" colspan="2" />
- <field name="website" colspan="2" />
+ <field name="address_id" colspan="2" />
+ <field name="website" colspan="2" />
<field name="image" widget='image' colspan="2" />
</page>
</notebook>
@@ -85,8 +52,25 @@
<field name="type">form</field>
<field name="arch" type="xml">
<field name="state" position="after">
- <field name="need_to_update" select="1" />
- </field>
+ <field name="need_to_update" />
+ </field>
+ <field name="amount_total" position="after">
+ <field name="ext_total_amount" string="Ext. Total" />
+ </field>
+ </field>
+ </record>
+
+ <record id="view_sales_order_filter" model="ir.ui.view">
+ <field name="name">base_sale_multichannel.view_sales_order_filter</field>
+ <field name="model">sale.order</field>
+ <field name="inherit_id" ref="sale.view_sales_order_filter" />
+ <field name="type">search</field>
+ <field eval="32" name="priority"/>
+ <field name="arch" type="xml">
+ <filter icon="terp-check" string="Sales" position="after">
+ <separator orientation="vertical"/>
+ <filter icon="gtk-refresh" name="to-update" string="TO UPDATE" domain="[('need_to_update','!=',False)]"/>
+ </filter>
</field>
</record>
@@ -103,13 +87,14 @@
<group name="external_payment" attrs="{'invisible': [('referential_id', '=', False)]}">
<separator string="External Payment" colspan="4"/>
<field name="ext_total_amount" />
- <field name="need_to_update" select="1"/>
+ <field name="need_to_update" />
</group>
</group>
<xpath expr="/form/notebook/page/field/form/notebook/page[@string='Order Line']/group" position="after">
<group name='External Information' colspan="4">
<separator string="External Information" colspan="4" />
- <field name="ext_product_ref" select="1" />
+ <field name="ext_product_ref" />
+ <field name="ext_ref_line" select="1" />
</group>
</xpath>
</data>
@@ -124,7 +109,7 @@
<field name="arch" type="xml">
<data>
<field name="product_id" position="after">
- <field name="ext_product_ref" select="1" />
+ <field name="ext_product_ref" />
</field>
</data>
</field>
@@ -141,6 +126,7 @@
<group name='External Syncronization' colspan="4">
<separator string="External syncronization" colspan="4" />
<field name="ext_product_ref" select="1" />
+ <field name="ext_ref_line" select="1" />
</group>
</field>
</data>
@@ -182,49 +168,49 @@
</record>
<act_window
- id="base_external_referentials.ext_product_product"
+ id="base_external_referentials.ext_product_product"
name="External Product"
- res_model="ir.model.data"
+ res_model="ir.model.data"
src_model="product.product"
domain="[('res_id', '=', active_id), ('model', '=', 'product.product')]"
/>
-
+
<act_window
- id="base_external_referentials.ext_product_category"
+ id="base_external_referentials.ext_product_category"
name="External Category"
- res_model="ir.model.data"
+ res_model="ir.model.data"
src_model="product.category"
domain="[('res_id', '=', active_id), ('model', '=', 'product.category')]"
/>
<act_window
- id="base_external_referentials.ext_sale_order"
+ id="base_external_referentials.ext_sale_order"
name="External Order"
- res_model="ir.model.data"
+ res_model="ir.model.data"
src_model="sale.order"
domain="[('res_id', '=', active_id), ('model', '=', 'sale.order')]"
/>
-
+
<act_window
- id="base_external_referentials.ext_sale_shop"
+ id="base_external_referentials.ext_sale_shop"
name="External Shop"
- res_model="ir.model.data"
+ res_model="ir.model.data"
src_model="sale.shop"
domain="[('res_id', '=', active_id), ('model', '=', 'sale.shop')]"
/>
-
+
<act_window
- id="base_external_referentials.ext_res_partner"
+ id="base_external_referentials.ext_res_partner"
name="External Partner"
- res_model="ir.model.data"
+ res_model="ir.model.data"
src_model="res.partner"
domain="[('res_id', '=', active_id), ('model', '=', 'res.partner')]"
/>
-
+
<act_window
- id="base_external_referentials.ext_res_partner_address"
+ id="base_external_referentials.ext_res_partner_address"
name="External Address"
- res_model="ir.model.data"
+ res_model="ir.model.data"
src_model="res.partner.address"
domain="[('res_id', '=', active_id), ('model', '=', 'res.partner.address')]"
/>
=== modified file 'base_sale_multichannels/security/ir.model.access.csv'
--- base_sale_multichannels/security/ir.model.access.csv 2012-04-26 15:47:51 +0000
+++ base_sale_multichannels/security/ir.model.access.csv 2012-11-19 23:40:29 +0000
@@ -14,3 +14,5 @@
"access_sale_sale_shop","sale_sale_shop","sale.model_sale_shop","base.group_sale_manager",1,1,1,1
"access_base_sale_multichannels_ir_model_data","base_sale_multichannels_ir_model_data","base.model_ir_model_data","base.group_sale_manager",1,1,1,1
"access_base_sale_multichannels_external_shop_group","base_sale_multichannels_external_shop_group","model_external_shop_group","base.group_user",1,0,0,0
+"access_account_tax_group_user","Read-only access to account.tax.group","model_account_tax_group","base.group_user",1,0,0,0
+"access_account_tax_group_account_manager","RW access to account.tax.group","model_account_tax_group","account.group_account_manager",1,1,1,1
=== modified file 'base_sale_multichannels/stock.py'
--- base_sale_multichannels/stock.py 2012-04-30 23:38:34 +0000
+++ base_sale_multichannels/stock.py 2012-11-19 23:40:29 +0000
@@ -19,10 +19,12 @@
#along with this program. If not, see <http://www.gnu.org/licenses/>. #
#########################################################################
-from osv import fields,osv
+from openerp.osv.orm import Model
+from openerp.osv import fields
+from openerp.osv.osv import except_osv
from tools.translate import _
-class stock_picking(osv.osv):
+class stock_picking(Model):
_inherit = "stock.picking"
_columns = {
@@ -35,12 +37,10 @@
}
def create_ext_shipping(self, cr, uid, id, picking_type, external_referential_id, context):
- osv.except_osv(_("Not Implemented"), _("Not Implemented in abstract base module!"))
+ raise except_osv(_("Not Implemented"), _("Not Implemented in abstract base module!"))
def _prepare_invoice(self, cr, uid, picking, partner, inv_type, journal_id, context=None):
vals = super(stock_picking, self)._prepare_invoice(cr, uid, picking, partner, \
inv_type, journal_id, context=context)
vals['shop_id'] = picking.shop_id.id
return vals
-
-stock_picking()
=== modified file 'base_sale_multichannels/wizard/__init__.py'
--- base_sale_multichannels/wizard/__init__.py 2012-06-11 07:33:40 +0000
+++ base_sale_multichannels/wizard/__init__.py 2012-11-19 23:40:29 +0000
@@ -18,6 +18,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
-import export_product
+
import import_order
=== removed file 'base_sale_multichannels/wizard/export_product.py'
--- base_sale_multichannels/wizard/export_product.py 2012-08-21 07:38:58 +0000
+++ base_sale_multichannels/wizard/export_product.py 1970-01-01 00:00:00 +0000
@@ -1,92 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# Base_sale_multichannels module for OpenERP
-# Copyright (C) 2010 Sébastien BEAU <sebastien.beau@xxxxxxxxxxxx>
-#
-# 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 <http://www.gnu.org/licenses/>.
-#
-##############################################################################
-
-
-from osv import fields,osv
-from tools.translate import _
-from base_external_referentials.external_osv import ExternalSession
-
-class product_export_wizard(osv.osv_memory):
- _name = 'product.export.wizard'
- _description = 'product export wizard'
-
- _columns = {
- 'shop': fields.many2many('sale.shop', 'shop_rel', 'shop_id', 'product_id', 'Shop', required=True),
- }
-
- def _export_one_product(self, cr, uid, external_session, product_id, options, context=None):
- product_obj = self.pool.get('product.product')
- if 'export_product' in options:
- product_obj._export_one_resource(cr, uid, external_session, product_id, context=context)
- if 'export_inventory' in options:
- product_obj.export_inventory(cr, uid, external_session, [product_id], context=context)
- if 'export_image' in options:
- product_obj.export_product_images(cr, uid, external_session, [product_id], context=context)
- return True
-
- def export(self, cr, uid, id, options, context=None):
- if context is None:
- context={}
- shop_ids = self.read(cr, uid, id, context=context)[0]['shop']
- sale_shop_obj = self.pool.get('sale.shop')
- product_obj = self.pool.get('product.product')
- product_ids = context['active_ids']
-
- for shop in sale_shop_obj.browse(cr, uid, shop_ids, context=context):
- if not shop.referential_id:
- raise osv.except_osv(_("User Error"), _(("The shop '%s' doesn't have any external "
- "referential are you sure that it's an externe sale shop?"
- "If yes syncronize it before exporting product"))%(shop.name,))
- external_session = ExternalSession(shop.referential_id, shop)
- context = self.pool.get('sale.shop').init_context_before_exporting_resource(cr, uid, external_session, shop.id, 'product.product', context=context)
- none_exportable_product = set(product_ids) - set([product.id for product in shop.exportable_product_ids])
- if none_exportable_product:
- products = ', '.join([x['name'] for x in product_obj.read(cr, uid, list(none_exportable_product), fields = ['name'], context=context)])
- raise osv.except_osv(_("User Error"),
- _(("The product '%s' can not be exported to the shop '%s'. \n"
- "Please check : \n"
- " - if they are in the root category \n"
- " - if the website option is correctly configured. \n"
- " - if the check box to export the product to the shop is checked"))%(products, shop.name))
- for product_id in product_ids:
- self._export_one_product(cr, uid, external_session, product_id, options, context=context)
- return {'type': 'ir.actions.act_window_close'}
-
- def export_product(self, cr, uid, id, context=None):
- return self.export(cr, uid, id, ['export_product'], context)
-
- def export_inventory(self, cr, uid, id, context=None):
- return self.export(
- cr, uid, id, ['export_inventory'], context)
-
- def export_image(self, cr, uid, id, context=None):
- return self.export(
- cr, uid, id, ['export_image'], context)
-
- def _get_all_options(self, cr, uid, context=None):
- return ['export_product', 'export_inventory', 'export_image']
-
- def export_all(self, cr, uid, id, context=None):
- return self.export(cr, uid, id, self._get_all_options(cr, uid, context=context), context)
-
-
-
-product_export_wizard()
=== removed file 'base_sale_multichannels/wizard/export_product.xml'
--- base_sale_multichannels/wizard/export_product.xml 2012-05-09 16:52:21 +0000
+++ base_sale_multichannels/wizard/export_product.xml 1970-01-01 00:00:00 +0000
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<openerp>
- <data>
-
- <record model="ir.ui.view" id="product_export_wizard_view">
- <field name="name">product.export.wizard.view</field>
- <field name="model">product.export.wizard</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Select The Shop To Syncronize">
- <field name="shop" nolabel="1" colspan='4'/>
- <button icon="gtk-cancel" special="cancel" string="Cancel"/>
- <button icon="gtk-ok" name="export_product" string="Export Product" type="object"/>
- <button icon="gtk-ok" name="export_inventory" string="Export Stock" type="object"/>
- <button icon="gtk-ok" name="export_image" string="Export Image" type="object"/>
- <button icon="gtk-ok" name="export_all" string="Export All" type="object"/>
- </form>
- </field>
- </record>
-
- <record id="action_product_export_wizard" model="ir.actions.act_window">
- <field name="name">Export Product</field>
- <field name="type">ir.actions.act_window</field>
- <field name="res_model">product.export.wizard</field>
- <field name="view_type">form</field>
- <field name="view_mode">form</field>
- <field name="target">new</field>
- <field name="context">{}</field>
- </record>
-
- <record id="ir_action_export_product_wizard" model="ir.values">
- <field name="key2">client_action_multi</field>
- <field name="model">product.product</field>
- <field name="name">Export Product</field>
- <field eval="'ir.actions.act_window,%d'%action_product_export_wizard" name="value"/>
- <field eval="True" name="object"/>
- </record>
- </data>
-</openerp>
=== modified file 'base_sale_report_synchronizer/__init__.py'
--- base_sale_report_synchronizer/__init__.py 2012-06-01 17:46:55 +0000
+++ base_sale_report_synchronizer/__init__.py 2012-11-19 23:40:29 +0000
@@ -19,11 +19,4 @@
# #
###############################################################################
-
-
-import invoice
import sale
-import external_referential
-
-
-
=== modified file 'base_sale_report_synchronizer/__openerp__.py'
--- base_sale_report_synchronizer/__openerp__.py 2012-06-01 17:46:55 +0000
+++ base_sale_report_synchronizer/__openerp__.py 2012-11-19 23:40:29 +0000
@@ -32,10 +32,12 @@
""",
'author': 'Akretion',
'website': 'http://www.akretion.com/',
- 'depends': ['report_synchronizer', 'base_sale_multichannels'],
+ 'depends': [
+ 'base_sale_multichannels',
+ 'report_synchronizer',
+ ],
'init_xml': [],
'update_xml': [
- 'external_referential_view.xml',
'sale_view.xml',
],
'demo_xml': [],
=== removed file 'base_sale_report_synchronizer/external_referential.py'
--- base_sale_report_synchronizer/external_referential.py 2012-06-01 17:46:55 +0000
+++ base_sale_report_synchronizer/external_referential.py 1970-01-01 00:00:00 +0000
@@ -1,31 +0,0 @@
-# -*- encoding: utf-8 -*-
-###############################################################################
-# #
-# base_sale_report_synchronizer for OpenERP #
-# Copyright (C) 2012 Akretion Sébastien BEAU <sebastien.beau@xxxxxxxxxxxx> #
-# #
-# 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 <http://www.gnu.org/licenses/>. #
-# #
-###############################################################################
-
-from osv import osv, fields
-import netsvc
-
-class external_referential(osv.osv):
- _inherit = "external.referential"
-
- _columns = {
- 'ext_file_referential_id': fields.many2one('external.referential', 'External Referential File'),
- }
-
=== removed file 'base_sale_report_synchronizer/external_referential_view.xml'
--- base_sale_report_synchronizer/external_referential_view.xml 2012-06-01 17:46:55 +0000
+++ base_sale_report_synchronizer/external_referential_view.xml 1970-01-01 00:00:00 +0000
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- base_sale_report_synchronizer for OpenERP
- Copyright (C) 2012 Akretion Sébastien BEAU <sebastien.beau@xxxxxxxxxxxx>
- The licence is in the file __openerp__.py
--->
-
-<openerp>
- <data>
- <record id="external_referential_form_view" model="ir.ui.view">
- <field name="name">base_sale_report_synchronizer.external_referential_form_view</field>
- <field name="model">external.referential</field>
- <field name="inherit_id" ref="base_external_referentials.external_referential_form_view" />
- <field name="type">form</field>
- <field name="arch" type="xml">
- <field name="location" position="after">
- <field name="ext_file_referential_id"/>
- </field>
- </field>
- </record>
- </data>
-</openerp>
=== removed file 'base_sale_report_synchronizer/invoice.py'
--- base_sale_report_synchronizer/invoice.py 2012-06-21 17:43:39 +0000
+++ base_sale_report_synchronizer/invoice.py 1970-01-01 00:00:00 +0000
@@ -1,60 +0,0 @@
-# -*- encoding: utf-8 -*-
-###############################################################################
-# #
-# base_sale_multichannels for OpenERP #
-# Copyright (C) 2011 Akretion Sébastien BEAU <sebastien.beau@xxxxxxxxxxxx> #
-# #
-# 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 <http://www.gnu.org/licenses/>. #
-# #
-###############################################################################
-from osv import osv, fields
-from tools.translate import _
-from base_external_referentials.external_osv import ExternalSession
-import os
-
-class account_invoice(osv.osv):
- _inherit='account.invoice'
-
- def _export_one_resource(self, cr, uid, external_session, invoice_id, context=None):
- #TODO think about a better solution to pass the report_name
- context['report_name'] = self._send_invoice_report(cr, uid, external_session,
- invoice_id, context=context)
- return super(account_invoice, self)._export_one_resource(cr, uid, external_session,
- invoice_id, context=context)
-
- def _send_invoice_report(self, cr, uid, external_session, invoice_id, context=None):
- invoice = self.browse(cr, uid, invoice_id, context=context)
- invoice_number = invoice.number.replace('/', '-')
- invoice_path = self._get_invoice_path(cr, uid, external_session, invoice, context=context)
- if not external_session.sync_from_object.invoice_report:
- raise osv.except_osv(_("User Error"), _("You must define a report for the invoice for your sale shop"))
- report_name = "report.%s"%external_session.sync_from_object.invoice_report.report_name
- if not hasattr(external_session, 'file_session'):
- external_session.file_session = ExternalSession(
- external_session.referential_id.ext_file_referential_id,
- external_session.sync_from_object,
- )
- return self.send_report(cr, uid, external_session.file_session, [invoice.id], report_name,
- invoice_number, invoice_path, context=context)
-
- def _get_invoice_path(self, cr, uid, external_session, invoice, context=None):
- ref_id = external_session.referential_id.id
- ext_partner_id = invoice.partner_id.get_extid(ref_id, context=context)
- ext_sale_id = invoice.sale_ids[0].get_extid(ref_id, context=context)
- if invoice.type == 'out_invoice':
- basepath = 'invoice'
- elif invoice.type == 'out_refund':
- basepath = 'creditmemo'
- return os.path.join(basepath, str(ext_partner_id), str(ext_sale_id))
-
=== modified file 'base_sale_report_synchronizer/sale.py'
--- base_sale_report_synchronizer/sale.py 2012-06-01 17:46:55 +0000
+++ base_sale_report_synchronizer/sale.py 2012-11-19 23:40:29 +0000
@@ -19,9 +19,10 @@
# #
###############################################################################
-from osv import osv, fields
+from openerp.osv.orm import Model
+from openerp.osv import fields
-class sale_shop(osv.osv):
+class sale_shop(Model):
_inherit = "sale.shop"
_columns = {
=== modified file 'base_sale_report_synchronizer/sale_view.xml'
--- base_sale_report_synchronizer/sale_view.xml 2012-06-22 09:27:04 +0000
+++ base_sale_report_synchronizer/sale_view.xml 2012-11-19 23:40:29 +0000
@@ -2,7 +2,7 @@
<openerp>
<data>
- <record model="ir.ui.view" id="base_sale_multichannels_view_shop_form">
+ <record model="ir.ui.view" id="view_shop_form">
<field name="name">base_sale_multichannels_view_shop_form</field>
<field name="model">sale.shop</field>
<field name="inherit_id" ref="sale.view_shop_form" />
=== modified file 'product_custom_attributes_shop/__openerp__.py'
--- product_custom_attributes_shop/__openerp__.py 2012-08-10 12:03:22 +0000
+++ product_custom_attributes_shop/__openerp__.py 2012-11-19 23:40:29 +0000
@@ -29,11 +29,12 @@
'description': """empty""",
'author': 'Akretion',
'website': 'http://www.akretion.com/',
- 'depends': ['base_sale_multichannels', 'product_custom_attributes'],
+ 'depends': ['base_sale_multichannels', 'product_custom_attributes'],
'init_xml': [],
- 'update_xml': [
+ 'update_xml': [
'sale_view.xml',
'product_attribute_view.xml',
+ 'security/ir.model.access.csv',
],
'demo_xml': [],
'installable': True,
=== modified file 'product_custom_attributes_shop/product.py'
--- product_custom_attributes_shop/product.py 2012-08-21 09:16:01 +0000
+++ product_custom_attributes_shop/product.py 2012-11-19 23:40:29 +0000
@@ -19,20 +19,18 @@
# #
###############################################################################
-from osv import osv, fields
+from openerp.osv.orm import Model
+from openerp.osv import fields
+from openerp.osv.osv import except_osv
import netsvc
from lxml import etree
-from tools.translate import _
+from openerp.tools.translate import _
import re
-class product_product(osv.osv):
-
+class product_product(Model):
_inherit = "product.product"
- _columns = {
- }
-
def _build_shop_attributes_notebook(self, cr, uid, shops, context=None):
notebook = etree.Element('notebook', name="shop_attributes_notebook", colspan="4")
toupdate_fields = []
@@ -63,6 +61,7 @@
main_page.append(attributes_notebook)
info_page.addnext(main_page)
result['arch'] = etree.tostring(eview, pretty_print=True)
+ result = self._fix_size_bug(cr, uid, result, context=context)
return result
def check_if_activable(self, cr, uid, vals, context=None):
@@ -72,7 +71,7 @@
shop_id = int(key.replace('x_shop', '').replace('_attr_active', ''))
if not self.pool.get('product.category').check_if_in_shop_category(cr, uid, categ_ids, shop_id, context=context):
shop = self.pool.get('sale.shop').browse(cr, uid, shop_id, context=context)
- raise osv.except_osv(_("User Error"),
+ raise except_osv(_("User Error"),
_(("The product must be in an children of one of this categories \"%s\" "
"in order to be activable on the shop \"%s\""))
%('", "'.join([categ.name for categ in shop.exportable_root_category_ids]), shop.name))
@@ -102,7 +101,7 @@
self.check_if_activable(cr, uid, product, context=context)
return res
-class product_category(osv.osv):
+class product_category(Model):
_inherit = 'product.category'
def check_if_in_shop_category(self, cr, uid, categ_ids, shop_id, context=None):
=== modified file 'product_custom_attributes_shop/product_attribute.py'
--- product_custom_attributes_shop/product_attribute.py 2012-08-10 12:03:22 +0000
+++ product_custom_attributes_shop/product_attribute.py 2012-11-19 23:40:29 +0000
@@ -19,10 +19,11 @@
# #
###############################################################################
-from osv import osv, fields
+from openerp.osv.orm import Model
+from openerp.osv import fields
import netsvc
-class attribute_shop_location(osv.osv):
+class attribute_shop_location(Model):
_name = "attribute.shop.location"
_description = "Attribute Shop Location"
=== modified file 'product_custom_attributes_shop/sale.py'
--- product_custom_attributes_shop/sale.py 2012-08-14 18:14:01 +0000
+++ product_custom_attributes_shop/sale.py 2012-11-19 23:40:29 +0000
@@ -19,11 +19,12 @@
# #
###############################################################################
-from osv import osv, fields
+from openerp.osv.orm import Model
+from openerp.osv import fields
import netsvc
-class sale_shop(osv.osv):
+class sale_shop(Model):
_inherit = "sale.shop"
=== added directory 'product_custom_attributes_shop/security'
=== added file 'product_custom_attributes_shop/security/ir.model.access.csv'
--- product_custom_attributes_shop/security/ir.model.access.csv 1970-01-01 00:00:00 +0000
+++ product_custom_attributes_shop/security/ir.model.access.csv 2012-11-19 23:40:29 +0000
@@ -0,0 +1,4 @@
+id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
+access_attribute_shop_location_read,Read-only access to attribute.shop.location,model_attribute_shop_location,base.group_user,1,0,0,0
+access_attribute_shop_location_stock_mgr,RW access to attribute.shop.location,model_attribute_shop_location,stock.group_stock_manager,1,1,1,1
+access_attribute_shop_location_sale_mgr,RW access to attribute.shop.location,model_attribute_shop_location,base.group_sale_manager,1,1,1,1
=== modified file 'product_links/__openerp__.py'
--- product_links/__openerp__.py 2011-11-29 15:09:07 +0000
+++ product_links/__openerp__.py 2012-11-19 23:40:29 +0000
@@ -33,7 +33,7 @@
""",
'author': 'Camptocamp',
'website': 'http://www.camptocamp.com',
- 'depends': ['base','product'],
+ 'depends': ['stock'],
'init_xml': [],
'update_xml': [
'security/ir.model.access.csv',
=== modified file 'product_links/product_links.py'
--- product_links/product_links.py 2012-05-19 11:15:38 +0000
+++ product_links/product_links.py 2012-11-19 23:40:29 +0000
@@ -18,9 +18,10 @@
#
##############################################################################
-from osv import fields, osv
+from openerp.osv.orm import Model
+from openerp.osv import fields
-class product_link(osv.osv):
+class product_link(Model):
_name = 'product.link'
_rec_name = 'linked_product_id'
@@ -38,14 +39,20 @@
'is_active': fields.boolean('Active'),
}
+ # It seems that it's not possible to set the default value of a field in
+ # a one2many via the context (it works well with a many2one though)
+ # So I have to set explicitly a default value
+ def _get_default_product_id(self, cr, uid, context=None):
+ if context is None:
+ context = {}
+ return context.get('product_id')
_defaults = {
'is_active': True,
+ 'product_id': _get_default_product_id,
}
-product_link()
-
-class product(osv.osv):
+class product(Model):
"""Inherit product in order to manage product links"""
_inherit = 'product.product'
@@ -54,9 +61,5 @@
'product.link',
'product_id',
'Product links',
- required=False,
-
),
}
-
-product()
=== modified file 'product_links/product_links_view.xml'
--- product_links/product_links_view.xml 2012-05-12 23:10:22 +0000
+++ product_links/product_links_view.xml 2012-11-19 23:40:29 +0000
@@ -10,7 +10,7 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Product Links">
- <!--<field name="product_id" select="1" invisible="not context.get('product_link_main_view')"/>-->
+ <field name="product_id" invisible="not context.get('product_link_main_view')" select="1"/>
<field name="is_active" select="1" />
<field name="linked_product_id" select="1" />
<field name="type" select="1" />
@@ -26,10 +26,10 @@
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Product Links">
- <!--<field name="product_id" select="1" invisible="not context.get('product_link_main_view')" />-->
- <field name="is_active" select="1" />
- <field name="linked_product_id" select="1" />
- <field name="type" select="1" />
+ <field name="product_id" invisible="not context.get('product_link_main_view')" />
+ <field name="is_active" />
+ <field name="linked_product_id" />
+ <field name="type" />
</tree>
</field>
</record>
@@ -42,10 +42,22 @@
<field name="arch" type="xml">
<notebook position="inside">
<page string="Product Links">
- <field name="product_link_ids" colspan="4" nolabel="1" />
+ <field name="product_link_ids" colspan="4" nolabel="1" context="{'product_id': active_id}"/>
</page>
</notebook>
</field>
</record>
+
+ <record id="product_link_action" model="ir.actions.act_window">
+ <field name="name">Product Links</field>
+ <field name="res_model">product.link</field>
+ <field name="view_type">form</field>
+ <field name="view_mode">tree,form</field>
+ <field name="context">{'product_link_main_view': True}</field>
+ </record>
+
+ <menuitem id="product_link_menu" parent="stock.menu_product_in_config_stock"
+ action="product_link_action" sequence="100"/>
+
</data>
</openerp>
=== modified file 'product_links/security/ir.model.access.csv'
--- product_links/security/ir.model.access.csv 2011-11-29 15:09:07 +0000
+++ product_links/security/ir.model.access.csv 2012-11-19 23:40:29 +0000
@@ -1,3 +1,3 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
-"access_product_link_employee","product link employee","model_product_link","base.group_user",1,0,0,01,1
+"access_product_link_employee","product link employee","model_product_link","base.group_user",1,0,0,0
"access_product_link_sale_manager","product link sale manager","model_product_link","base.group_sale_manager",1,1,1,1
=== modified file 'product_links_goodies/product_links.py'
--- product_links_goodies/product_links.py 2012-08-21 07:38:58 +0000
+++ product_links_goodies/product_links.py 2012-11-19 23:40:29 +0000
@@ -19,11 +19,12 @@
# #
###############################################################################
-from osv import osv, fields
+from openerp.osv.orm import Model
+from openerp.osv import fields
import netsvc
from datetime import datetime
-class product_link(osv.osv):
+class product_link(Model):
_inherit = "product.link"
_columns = {
@@ -73,7 +74,7 @@
], context=context)
self.write(cr, uid, to_active_ids, {'is_active': True}, context=context)
-class product_product(osv.osv):
+class product_product(Model):
_inherit = 'product.product'
def _get_supplier_goodies_ids(self, cr, uid, ids, name, arg, context=None):
=== modified file 'product_links_goodies/purchase.py'
--- product_links_goodies/purchase.py 2012-08-21 09:16:01 +0000
+++ product_links_goodies/purchase.py 2012-11-19 23:40:29 +0000
@@ -20,9 +20,10 @@
###############################################################################
-from osv import osv, fields
+from openerp.osv.orm import Model
+from openerp.osv import fields
-class purchase_order_line(osv.osv):
+class purchase_order_line(Model):
_inherit = "purchase.order.line"
_columns = {
@@ -161,5 +162,3 @@
'order_id': order.id,
'goodie_for_line_id': line_id
}
-
-
=== modified file 'product_links_sync/__openerp__.py'
--- product_links_sync/__openerp__.py 2012-05-12 23:06:47 +0000
+++ product_links_sync/__openerp__.py 2012-11-19 23:40:29 +0000
@@ -32,7 +32,7 @@
""",
'author': 'Akretion',
'website': 'http://www.akretion.com/',
- 'depends': ['base_sale_multichannels', 'product_links'],
+ 'depends': ['base_sale_export_product', 'product_links'],
'init_xml': [],
'update_xml': [
'sale_view.xml',
=== modified file 'product_links_sync/product.py'
--- product_links_sync/product.py 2012-08-21 07:38:58 +0000
+++ product_links_sync/product.py 2012-11-19 23:40:29 +0000
@@ -1,8 +1,8 @@
# -*- encoding: utf-8 -*-
###############################################################################
# #
-# product_links_sync for OpenERP #
-# Copyright (C) 2012 Akretion Sébastien BEAU <sebastien.beau@xxxxxxxxxxxx> #
+# product_links_sync for OpenERP #
+# Copyright (C) 2012 Akretion Sébastien BEAU <sebastien.beau@xxxxxxxxxxxx> #
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU Affero General Public License as #
@@ -19,14 +19,17 @@
# #
###############################################################################
-from osv import osv, fields
-import netsvc
-from tools import DEFAULT_SERVER_DATETIME_FORMAT
from datetime import datetime
+
+from openerp.osv.orm import Model
+from openerp.osv.orm import TransientModel
+from openerp.osv import fields
+from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT
from base_external_referentials.decorator import only_for_referential
from base_external_referentials.decorator import commit_now
-class product_product(osv.osv):
+
+class product_product(Model):
_inherit = "product.product"
_columns = {
@@ -50,7 +53,7 @@
def _get_query_and_params_for_ids_and_date(self, cr, uid, external_session, ids=None, last_exported_date=None, context=None):
if context.get('export_product') != 'link':
- return super(product_product, self)._get_query_and_params_for_ids_and_date(cr, uid,
+ return super(product_product, self)._get_query_and_params_for_ids_and_date(cr, uid,
external_session, ids=ids, last_exported_date=last_exported_date, context=context)
else:
# We have to export all product link that believe to a product which have the link modify
@@ -85,10 +88,6 @@
if 'product_link_ids' in fields_to_read: fields_to_read.remove('product_link_ids')
return fields_to_read
-# def export_links_for_product(self, cr, uid, ids, context=None):
-# """ Not implemented in this abstract module"""
-# return False
-
@only_for_referential(ref_categ ='Multichannel Sale')
def _get_last_exported_date(self, cr, uid, external_session, context):
shop = external_session.sync_from_object
@@ -107,9 +106,9 @@
return super(product_product, self)._set_last_exported_date(cr, uid, external_session, date, context)
-class product_link(osv.osv):
+class product_link(Model):
_inherit = "product.link"
-
+
def write(self, cr, uid, ids, vals, context=None):
if context is None: context={}
if 'is_active' in vals and not context.get('product_link_date_updated'):
@@ -120,7 +119,7 @@
return super(product_link, self).write(cr, uid, ids, vals, context=context)
-class product_export_wizard(osv.osv_memory):
+class product_export_wizard(TransientModel):
_inherit = 'product.export.wizard'
def _export_one_product(self, cr, uid, external_session, product_id, options, context=None):
=== modified file 'product_links_sync/sale.py'
--- product_links_sync/sale.py 2012-05-12 23:06:47 +0000
+++ product_links_sync/sale.py 2012-11-19 23:40:29 +0000
@@ -1,8 +1,8 @@
# -*- encoding: utf-8 -*-
###############################################################################
# #
-# product_links_sync for OpenERP #
-# Copyright (C) 2012 Akretion Sébastien BEAU <sebastien.beau@xxxxxxxxxxxx> #
+# product_links_sync for OpenERP #
+# Copyright (C) 2012 Akretion Sébastien BEAU <sebastien.beau@xxxxxxxxxxxx> #
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU Affero General Public License as #
@@ -19,14 +19,15 @@
# #
###############################################################################
-from osv import osv, fields
+from openerp.osv.orm import Model
+from openerp.osv import fields
import netsvc
from tools import DEFAULT_SERVER_DATETIME_FORMAT
from datetime import datetime
-class sale_shop(osv.osv):
+class sale_shop(Model):
_inherit = "sale.shop"
_columns = {
=== modified file 'sale_automatic_workflow/automatic_workflow_job.py'
--- sale_automatic_workflow/automatic_workflow_job.py 2012-04-22 12:49:21 +0000
+++ sale_automatic_workflow/automatic_workflow_job.py 2012-11-19 23:40:29 +0000
@@ -20,10 +20,11 @@
#################################################################################
-from osv import osv
+from openerp.osv.orm import Model
import netsvc
import logging
from tools.translate import _
+from contextlib import contextmanager
#Some comment about the implementation
#In order to validate the invoice the picking we have to use schedule action
@@ -46,7 +47,28 @@
#If my explication is not clear contact me by email and I will imporve it: sebastien.beau@xxxxxxxxxxxx
-class automatic_workflow_job(osv.osv):
+@contextmanager
+def commit_now(cr, logger, raise_error=False):
+ """
+ Context Manager to use in order to commit into a cursor
+ correctly with a try/except method and a rollback if necessary
+ :param cr cursor: cursor to commit
+ :param logger logger: logger use for loging message
+ :param raise_error boolean: Set to true only if you want
+ to stop the process if an error occure
+ """
+ try:
+ yield cr
+ except Exception, e:
+ cr.rollback()
+ logger.exception(e)
+ if raise_error:
+ raise
+ else:
+ cr.commit()
+
+
+class automatic_workflow_job(Model):
"""
Scheduler that will play automatically the validation on invoice, picking...
"""
@@ -56,14 +78,25 @@
logger = logging.getLogger(__name__)
wf_service = netsvc.LocalService("workflow")
invoice_obj = self.pool.get('account.invoice')
+ open_invoice_ids = invoice_obj.search(cr, uid, [('state', 'in', ['open'])], context=context)
+
+ for open_invoice_id in open_invoice_ids:
+ with commit_now(cr, logger) as cr:
+ invoice_obj.reconcile_invoice(cr, uid, [open_invoice_id], context=context)
+
invoice_ids = invoice_obj.search(cr, uid, [('state', 'in', ['draft']), ('workflow_process_id.validate_invoice', '=',True)], context=context)
if invoice_ids:
logger.debug(_('start to validate invoice : %s') %invoice_ids)
for invoice_id in invoice_ids:
- wf_service.trg_validate(uid, 'account.invoice', invoice_id, 'invoice_open', cr)
+ with commit_now(cr, logger) as cr:
+ wf_service.trg_validate(uid, 'account.invoice', invoice_id, 'invoice_open', cr)
+ with commit_now(cr, logger) as cr:
+ invoice_obj.reconcile_invoice(cr, uid, [invoice_id], context=context)
+
picking_obj = self.pool.get('stock.picking')
picking_ids = picking_obj.search(cr, uid, [('state', 'in', ['draft', 'confirmed', 'assigned']), ('workflow_process_id.validate_picking', '=',True)], context=context)
if picking_ids:
logger.debug(_('start to validate pickings : %s') %picking_ids)
- picking_obj.validate_picking(cr, uid, picking_ids, context=context)
+ with commit_now(cr, logger) as cr:
+ picking_obj.validate_picking(cr, uid, picking_ids, context=context)
return True
=== modified file 'sale_automatic_workflow/payment_method.py'
--- sale_automatic_workflow/payment_method.py 2012-04-22 12:49:21 +0000
+++ sale_automatic_workflow/payment_method.py 2012-11-19 23:40:29 +0000
@@ -20,11 +20,11 @@
#################################################################################
-from osv import osv, fields
-import netsvc
-
-
-class payment_method(osv.osv):
+from openerp.osv.orm import Model
+from openerp.osv import fields
+
+
+class payment_method(Model):
_inherit = "payment.method"
=== modified file 'sale_automatic_workflow/sale.py'
--- sale_automatic_workflow/sale.py 2012-08-21 05:23:32 +0000
+++ sale_automatic_workflow/sale.py 2012-11-19 23:40:29 +0000
@@ -18,10 +18,10 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
# #
#################################################################################
-from osv import osv, fields
-import netsvc
+from openerp.osv.orm import Model
+from openerp.osv import fields
-class sale_order(osv.osv):
+class sale_order(Model):
_inherit = "sale.order"
_columns = {
'workflow_process_id':fields.related('payment_method_id', 'workflow_process_id', \
@@ -40,7 +40,7 @@
picking_vals['workflow_process_id'] = order.workflow_process_id.id
return picking_vals
-class stock_picking(osv.osv):
+class stock_picking(Model):
_inherit = "stock.picking"
_columns = {
'workflow_process_id':fields.many2one('sale.workflow.process', 'Sale Workflow Process'),
@@ -82,7 +82,7 @@
# return True
#
-class account_invoice(osv.osv):
+class account_invoice(Model):
_inherit = "account.invoice"
_columns = {
'workflow_process_id':fields.many2one('sale.workflow.process', 'Sale Workflow Process'),
@@ -113,9 +113,3 @@
if line_ids and not round(balance, precision):
obj_move_line.reconcile(cr, uid, line_ids, context=context)
return True
-
-
- def test_paid(self, cr, uid, ids, context=None):
- self.reconcile_invoice(cr, uid, ids, context=context)
- return super(account_invoice, self).test_paid(cr, uid, ids, context)
-
=== modified file 'sale_automatic_workflow/sale_workflow_process.py'
--- sale_automatic_workflow/sale_workflow_process.py 2012-05-06 17:55:14 +0000
+++ sale_automatic_workflow/sale_workflow_process.py 2012-11-19 23:40:29 +0000
@@ -19,11 +19,12 @@
# #
#################################################################################
-from osv import osv, fields
+from openerp.osv.orm import Model
+from openerp.osv import fields
import netsvc
-class sale_workflow_process(osv.osv):
+class sale_workflow_process(Model):
_name = "sale.workflow.process"
_description = "sale workflow process"
=== modified file 'sale_automatic_workflow/sale_workflow_process_view.xml'
--- sale_automatic_workflow/sale_workflow_process_view.xml 2012-04-22 12:49:21 +0000
+++ sale_automatic_workflow/sale_workflow_process_view.xml 2012-11-19 23:40:29 +0000
@@ -65,6 +65,9 @@
<menuitem action="act_sale_workflow_process_form" id="menu_act_sale_workflow_process_form" parent="base.menu_sale_config_sales" sequence="20"/>
+ </data>
+ <data noupdate="1">
+
<record forcecreate="True" id="ir_cron_automatic_workflow_job" model="ir.cron">
<field name="name">Automatic Workflow Job</field>
<field eval="True" name="active"/>
=== modified file 'sale_exceptions/sale.py'
--- sale_exceptions/sale.py 2012-03-23 14:41:02 +0000
+++ sale_exceptions/sale.py 2012-11-19 23:40:29 +0000
@@ -24,11 +24,13 @@
import time
import netsvc
-from osv import fields, osv
+from openerp.osv.orm import Model
+from openerp.osv import fields
+from openerp.osv.osv import except_osv
from tools.safe_eval import safe_eval as eval
from tools.translate import _
-class sale_exception(osv.osv):
+class sale_exception(Model):
_name = "sale.exception"
_description = "Sale Exceptions"
_columns = {
@@ -61,11 +63,11 @@
"""
}
-sale_exception()
-
-class sale_order(osv.osv):
+class sale_order(Model):
_inherit = "sale.order"
+ _order = 'main_exception_id asc, date_order desc, name desc'
+
def _get_main_error(self, cr, uid, ids, name, args, context=None):
res = {}
for sale_order in self.browse(cr, uid, ids, context=context):
@@ -73,9 +75,13 @@
return res
_columns = {
- 'main_exception_id': fields.function(_get_main_error, type='many2one',
- relation="sale.exception",
- string='Main Exception'),
+ 'main_exception_id': fields.function(_get_main_error,
+ type='many2one',
+ relation="sale.exception",
+ string='Main Exception',
+ store={
+ 'sale.order': (lambda self, cr, uid, ids, c={}: ids, ['exceptions_ids'], 10),
+ }),
'exceptions_ids': fields.many2many('sale.exception', 'sale_order_exception_rel',
'sale_order_id', 'exception_id',
string='Exceptions'),
@@ -170,7 +176,7 @@
eval(expr, space,
mode='exec', nocopy=True) # nocopy allows to return 'result'
except Exception, e:
- raise osv.except_osv(_('Error'), _('Error when evaluating the sale exception rule :\n %s \n(%s)') %
+ raise except_osv(_('Error'), _('Error when evaluating the sale exception rule :\n %s \n(%s)') %
(rule.name, e))
return space.get('failed', False)
@@ -197,5 +203,3 @@
'ignore_exceptions': False,
})
return super(sale_order, self).copy(cr, uid, id, default=default, context=context)
-
-sale_order()
=== modified file 'sale_exceptions/sale_exceptions_data.xml'
--- sale_exceptions/sale_exceptions_data.xml 2012-02-24 09:31:32 +0000
+++ sale_exceptions/sale_exceptions_data.xml 2012-11-19 23:40:29 +0000
@@ -14,6 +14,6 @@
<field eval="'test_all_draft_orders'" name="function"/>
<field eval="'()'" name="args"/>
</record>
-
+
</data>
</openerp>
=== modified file 'sale_exceptions/sale_view.xml'
--- sale_exceptions/sale_view.xml 2012-05-19 11:13:51 +0000
+++ sale_exceptions/sale_view.xml 2012-11-19 23:40:29 +0000
@@ -1,6 +1,6 @@
<?xml version="1.0" ?>
<openerp>
- <data>
+ <data>
<record id="view_sale_exception_search" model="ir.ui.view">
<field name="name">sale.exception.view.search</field>
@@ -67,7 +67,7 @@
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_sale_exception_tree"/>
<field name="search_view_id" ref="view_sale_exception_search"/>
- </record>
+ </record>
<menuitem action="action_sale_test_tree" id="menu_sale_test" parent="base.menu_sale_config_sales" />
@@ -76,32 +76,31 @@
<field name="name">sale_exceptions.view_order_form</field>
<field name="model">sale.order</field>
<field name="type">form</field>
+ <field name="priority">100</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
- <data>
- <xpath expr="/form/notebook/page[@string='Sales Order']/group/field[@name='state']"
- position="after">
- <field name="main_exception_id" nolabel="1"
- attrs="{'invisible':[('main_exception_id','=', False)]}"/>
- </xpath>
- <xpath expr="/form/notebook/page[@string='Other Information']/separator[@string='Notes']"
- position="before">
- <group name="exception" colspan="2" col="2">
- <separator string="Exception" colspan="2"/>
- <field name="exceptions_ids" colspan="2" nolabel="1"/>
- </group>
- <group name="notes" colspan="2" col="2">
- <separator colspan="2" string="Notes"/>
- <field colspan="2" name="note" nolabel="1"/>
- </group>
- </xpath>
- <xpath expr="/form/notebook/page[@string='Other Information']/separator[@string='Notes']" position="replace"/>
- <xpath expr="/form/notebook/page[@string='Other Information']/field[@name='note']" position="replace"/>
- <button name="order_confirm" position="attributes">
- <attribute name="name">button_order_confirm</attribute>
- <attribute name="type">object</attribute>
- </button>
- </data>
+ <xpath expr="/form/notebook/page[@string='Sales Order']/group/field[@name='state']"
+ position="after">
+ <field name="main_exception_id" nolabel="1"
+ attrs="{'invisible':[('main_exception_id','=', False)]}"/>
+ </xpath>
+ <xpath expr="/form/notebook/page[@string='Other Information']/separator[@string='Notes']"
+ position="before">
+ <group name="exception" colspan="2" col="2">
+ <separator string="Exception" colspan="2"/>
+ <field name="exceptions_ids" colspan="2" nolabel="1"/>
+ </group>
+ <group name="notes" colspan="2" col="2">
+ <separator colspan="2" string="Notes"/>
+ <field colspan="2" name="note" nolabel="1"/>
+ </group>
+ </xpath>
+ <xpath expr="/form/notebook/page[@string='Other Information']/separator[@string='Notes']" position="replace"/>
+ <xpath expr="/form/notebook/page[@string='Other Information']/field[@name='note']" position="replace"/>
+ <button name="order_confirm" position="attributes">
+ <attribute name="name">button_order_confirm</attribute>
+ <attribute name="type">object</attribute>
+ </button>
</field>
</record>
@@ -117,5 +116,18 @@
</field>
</record>
+ <record id="view_sales_order_filter" model="ir.ui.view">
+ <field name="name">sale_exceptions.view_sales_order_filter</field>
+ <field name="model">sale.order</field>
+ <field name="inherit_id" ref="sale.view_sales_order_filter" />
+ <field name="type">search</field>
+ <field eval="32" name="priority"/>
+ <field name="arch" type="xml">
+ <filter icon="terp-check" string="Sales" position="after">
+ <separator orientation="vertical"/>
+ <filter icon="terp-emblem-important" name="tofix" string="TO FIX" domain="[('main_exception_id','!=',False)]"/>
+ </filter>
+ </field>
+ </record>
</data>
</openerp>
=== modified file 'sale_quick_payment/company.py'
--- sale_quick_payment/company.py 2012-05-18 09:00:34 +0000
+++ sale_quick_payment/company.py 2012-11-19 23:40:29 +0000
@@ -19,10 +19,11 @@
# #
#################################################################################
-from osv import fields, osv
+from openerp.osv.orm import Model
+from openerp.osv import fields
from tools.translate import _
-class res_company(osv.osv):
+class res_company(Model):
"""Override company to add payment configuration"""
_inherit = "res.company"
_columns = {
@@ -30,5 +31,3 @@
help='If this option is check an order can not be validaded without payment'
),
}
-
-res_company()
=== modified file 'sale_quick_payment/payment_method.py'
--- sale_quick_payment/payment_method.py 2012-04-22 12:48:34 +0000
+++ sale_quick_payment/payment_method.py 2012-11-19 23:40:29 +0000
@@ -19,11 +19,12 @@
# #
###############################################################################
-from osv import osv, fields
+from openerp.osv.orm import Model
+from openerp.osv import fields
import netsvc
-class payment_method(osv.osv):
+class payment_method(Model):
_name = "payment.method"
_description = "payment method"
@@ -33,6 +34,5 @@
'name': fields.char('Name', size=64),
'journal_id': fields.many2one('account.journal', 'Journal'),
'payment_term_id': fields.many2one('account.payment.term', 'Payment Term'),
-
}
=== modified file 'sale_quick_payment/sale.py'
--- sale_quick_payment/sale.py 2012-05-18 09:00:34 +0000
+++ sale_quick_payment/sale.py 2012-11-19 23:40:29 +0000
@@ -19,12 +19,14 @@
# #
###############################################################################
-from osv import osv, fields
+from openerp.osv.orm import Model
+from openerp.osv import fields
+from openerp.osv.osv import except_osv
import netsvc
from collections import Iterable
-from tools.translate import _
+from openerp.tools.translate import _
-class sale_order(osv.osv):
+class sale_order(Model):
_inherit = "sale.order"
_columns = {
@@ -40,7 +42,6 @@
})
return super(sale_order, self).copy(cr, uid, id, default, context=context)
-
def pay_sale_order(self, cr, uid, sale_id, journal_id, amount, date, context=None):
"""
Generate a voucher for the payment
@@ -67,6 +68,8 @@
voucher_vals = {'reference': sale.name,
'journal_id': journal_id,
+ 'period_id': self.pool.get('account.period').find(cr, uid, dt=date,
+ context=context)[0],
'amount': amount,
'date': date,
'partner_id': sale.partner_id.id,
@@ -74,6 +77,22 @@
'currency_id': journal.company_id.currency_id.id,
'company_id': journal.company_id.id,
'type': 'receipt', }
+
+ # Set the payment rate if currency are different
+ if journal.currency.id and journal.company_id.currency_id.id != journal.currency.id:
+ currency_id = journal.company_id.currency_id.id
+ payment_rate_currency_id = journal.currency.id
+
+ currency_obj = self.pool.get('res.currency')
+ ctx= context.copy()
+ ctx.update({'date': date})
+ tmp = currency_obj.browse(cr, uid, payment_rate_currency_id, context=ctx).rate
+ payment_rate = tmp / currency_obj.browse(cr, uid, currency_id, context=ctx).rate
+ voucher_vals.update({
+ 'payment_rate_currency_id': payment_rate_currency_id,
+ 'payment_rate': payment_rate,
+ })
+
voucher_id = voucher_obj.create(cr, uid, voucher_vals, context=context)
# call on change to search the invoice lines
@@ -119,7 +138,7 @@
def button_order_confirm(self, cr, uid, ids, context=None):
for order in self.browse(cr, uid, ids, context=context):
if order.company_id.sale_order_must_be_paid and not order.payment_id:
- raise osv.except_osv(_('User Error !'),
+ raise except_osv(_('User Error !'),
_('The sale Order %s Must be paid before validation') % (order.name))
return super(sale_order, self).button_order_confirm(cr, uid, ids, context=context)
=== modified file 'sale_quick_payment/wizard/pay_sale_order.py'
--- sale_quick_payment/wizard/pay_sale_order.py 2012-06-21 17:39:14 +0000
+++ sale_quick_payment/wizard/pay_sale_order.py 2012-11-19 23:40:29 +0000
@@ -19,11 +19,13 @@
# #
#################################################################################
-from osv import fields,osv
+
+from openerp.osv.orm import TransientModel
+from openerp.osv import fields
import decimal_precision as dp
from datetime import datetime
-class pay_sale_order(osv.osv_memory):
+class pay_sale_order(TransientModel):
_name = 'pay.sale.order'
_description = 'Wizard to generate a payment from the sale order'