Merge lp:~sebastien.beau/magentoerpconnect/oerp6.1-cleanning into lp:magentoerpconnect/oerp6.1-stable

Proposed by Sébastien BEAU - http://www.akretion.com
Status: Merged
Merged at revision: 678
Proposed branch: lp:~sebastien.beau/magentoerpconnect/oerp6.1-cleanning
Merge into: lp:magentoerpconnect/oerp6.1-stable
Diff against target: 4911 lines (+1653/-1559)
65 files modified
magento_product_auto_sku/__openerp__.py (+1/-1)
magento_product_auto_sku/data.xml (+3/-3)
magento_product_auto_sku/product.py (+9/-15)
magento_sku_is_code/__init__.py (+0/-22)
magento_sku_is_code/__openerp__.py (+0/-41)
magento_sku_is_code/product.py (+0/-66)
magento_sku_is_code/product_view.xml (+0/-24)
magentoerpconnect/__openerp__.py (+2/-2)
magentoerpconnect/delivery.py (+6/-4)
magentoerpconnect/delivery_view.xml (+2/-2)
magentoerpconnect/invoice.py (+76/-27)
magentoerpconnect/magerp_core.py (+26/-26)
magentoerpconnect/magerp_core_view.xml (+152/-156)
magentoerpconnect/magerp_data.xml (+10/-10)
magentoerpconnect/magerp_menu.xml (+1/-1)
magentoerpconnect/magerp_osv.py (+67/-64)
magentoerpconnect/partner.py (+49/-49)
magentoerpconnect/partner_view.xml (+2/-6)
magentoerpconnect/product.py (+151/-186)
magentoerpconnect/product_images.py (+25/-19)
magentoerpconnect/product_images_view.xml (+21/-21)
magentoerpconnect/product_links.py (+6/-10)
magentoerpconnect/product_view.xml (+310/-310)
magentoerpconnect/sale.py (+40/-37)
magentoerpconnect/sale_view.xml (+72/-42)
magentoerpconnect/server_tmp.patch (+0/-14)
magentoerpconnect/settings/1.3.2.4/external.mappinglines.template.csv (+53/-53)
magentoerpconnect/settings/1.5.0.0/product.category/external.mappinglines.template.csv (+8/-8)
magentoerpconnect/settings/1.5.0.0/product/external.mappinglines.template.csv (+1/-1)
magentoerpconnect/settings/1.5.0.0/res.partner.address/external.mappinglines.template.csv (+13/-2)
magentoerpconnect/settings/1.5.0.0/res.partner/external.mappinglines.template.csv (+2/-1)
magentoerpconnect/settings/1.5.0.0/sale.order.line/external.mappinglines.template.csv (+3/-2)
magentoerpconnect/settings/1.5.0.0/sale.order/external.mappinglines.template.csv (+14/-3)
magentoerpconnect/stock.py (+4/-7)
magentoerpconnect/wizard/open_product_by_attribut_set.py (+5/-7)
magentoerpconnect_bundle/__openerp__.py (+3/-3)
magentoerpconnect_bundle/product.py (+9/-16)
magentoerpconnect_bundle/product_view.xml (+31/-31)
magentoerpconnect_bundle/sale.py (+4/-6)
magentoerpconnect_bundle/sale_bundle_product.py (+6/-16)
magentoerpconnect_bundle/sale_bundle_product_view.xml (+14/-14)
magentoerpconnect_bundle_split/__openerp__.py (+1/-1)
magentoerpconnect_bundle_split/sale.py (+16/-21)
magentoerpconnect_bundle_split/stock.py (+8/-14)
magentoerpconnect_customer_fiscal_category/__openerp__.py (+2/-2)
magentoerpconnect_customer_fiscal_category/settings/1.5.0.0/external.mappinglines.template.csv (+2/-7)
magentoerpconnect_init_stock/__openerp__.py (+1/-1)
magentoerpconnect_init_stock/product.py (+2/-5)
magentoerpconnect_magento_invoice/__init__.py (+28/-0)
magentoerpconnect_magento_invoice/__openerp__.py (+44/-0)
magentoerpconnect_magento_invoice/account.py (+35/-0)
magentoerpconnect_openerp_invoice/__init__.py (+1/-5)
magentoerpconnect_openerp_invoice/__openerp__.py (+9/-5)
magentoerpconnect_openerp_invoice/external_referential.py (+33/-0)
magentoerpconnect_openerp_invoice/external_referential_view.xml (+22/-0)
magentoerpconnect_openerp_invoice/invoice.py (+57/-24)
magentoerpconnect_partner_surname/__init__.py (+21/-0)
magentoerpconnect_partner_surname/__openerp__.py (+43/-0)
magentoerpconnect_partner_surname/settings/1.5.0.0/res.partner.address/external.mappinglines.template.csv (+3/-0)
magentoerpconnect_payment/__openerp__.py (+1/-1)
magentoerpconnect_payment/payment_type.py (+6/-8)
magentoerpconnect_payment/sale.py (+18/-20)
magentoerpconnect_product_variant/__openerp__.py (+3/-3)
magentoerpconnect_product_variant/product.py (+20/-38)
magentoerpconnect_product_variant/product_view.xml (+76/-76)
To merge this branch: bzr merge lp:~sebastien.beau/magentoerpconnect/oerp6.1-cleanning
Reviewer Review Type Date Requested Status
Alexandre Fayolle - camptocamp code review, no test Approve
Guewen Baconnier @ Camptocamp no test, review Needs Fixing
Review via email: mp+135024@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

Hi,

Some minor things:

Line 200:
The method ``map_magento_order`` is public (accessible from XMR/RPC) but may return a None value if they are zero or many invoices.

Line 1133
You've put an unused local variable ``first_install``.

Lines 1138-1149, I would rather use only one UPDATE with a CASE, it should something like:
UPDATE res_partner_address
SET name = CASE
  WHEN firstname IS NOT NULL AND lastname IS NOT NULL THEN (firstname || ' ' || lastname)
  WHEN firstname IS NOT NULL AND lastname IS NULL THEN firstname
  WHEN firstname IS NULL AND lastname IS NOT NULL THEN lastname
  ELSE '';

Otherwise, it seems good.
Thanks

review: Needs Fixing (no test, review)
Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

invoice.py
==========

map_magento_order is puzzling to me : it can return True or an invoice id, and there's a case where no id is mapped and nothing is logged (case when len(invoice_ids) != 1). This is probably something which should not happen, but I'd rather have a trace of the event.

in create_magento_invoice: s/synchronise/synchronize/ + remove spaces before ':' in english

magerp_core.py
===============

one leftover TODO (non blocking for the review)

product.py
==========

in _get_oe_resources, use iteritems rather than items (avoid generating a useless python list)

product_images.py
=================

not your fault, I could not understand the meaning of the comments at the beginning of the file. If you have a clearer idea of what is meant, clarification is welcome.

These are minor points, no need to resubmit before merging.

Thanks for your work.

review: Approve (code review, no test)
678. By Sébastien BEAU - http://www.akretion.com

[MERGE] merge with cleaning branch, please do not forget to update dependency, product-extra-addons, openobject-extention, e-commerce-adddons.

magentoerpconnect :
- REFACTOR
    - refactor the invoice syncronisation
        2 modules are available, 1 for using Magento Invoice, one for using OpenERP invoice
        moreover if invoice syncronisation failed try to map if an existing one already exist : fonction => map_magento_order
    - refactor view for compatibility in multi-e-commerce solution
    - NAME REFACTOR : by default use only name if you need to use the lastname and firstname please first update magentoerpconnect and them install magentoerpconnect_partner_surname. DO IT ON A DATABASE TEST BEFORE. If you have any trouble please open a bug on lp
    - use new api for moving the category and updating the stock information

    ADD
        - add reporting when exporting stock level

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'magento_product_auto_sku/__openerp__.py'
--- magento_product_auto_sku/__openerp__.py 2012-03-15 09:47:04 +0000
+++ magento_product_auto_sku/__openerp__.py 2012-12-03 15:22:20 +0000
@@ -20,7 +20,7 @@
20##############################################################################20##############################################################################
21{21{
22 'name' : 'magento_product_auto_sku',22 'name' : 'magento_product_auto_sku',
23 'version' : '1.0',23 'version' : '6.1.0',
24 'depends' : ['base', 'product', 'magentoerpconnect'],24 'depends' : ['base', 'product', 'magentoerpconnect'],
25 'author' : 'Camptocamp',25 'author' : 'Camptocamp',
26 'license': 'AGPL-3',26 'license': 'AGPL-3',
2727
=== modified file 'magento_product_auto_sku/data.xml'
--- magento_product_auto_sku/data.xml 2011-06-07 14:51:43 +0000
+++ magento_product_auto_sku/data.xml 2012-12-03 15:22:20 +0000
@@ -11,8 +11,8 @@
11 <field name="name">Product Magento SKU</field>11 <field name="name">Product Magento SKU</field>
12 <field name="code">product.magento.sku</field>12 <field name="code">product.magento.sku</field>
13 <field name="prefix">%(year)s/</field>13 <field name="prefix">%(year)s/</field>
14 <field name="padding">5</field> 14 <field name="padding">5</field>
15 </record> 15 </record>
16 16
17 </data>17 </data>
18</openerp>18</openerp>
1919
=== modified file 'magento_product_auto_sku/product.py'
--- magento_product_auto_sku/product.py 2012-03-15 09:47:04 +0000
+++ magento_product_auto_sku/product.py 2012-12-03 15:22:20 +0000
@@ -17,25 +17,19 @@
17# You should have received a copy of the GNU Affero General Public License17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#19#
20############################################################################## 20##############################################################################
21from osv import osv, fields21from openerp.osv.orm import Model
2222from openerp.osv import fields
2323
24class Product(osv.osv):24class Product(Model):
25 " Inherit product to add the sequence on the Magento SKU field"25 " Inherit product to add the sequence on the Magento SKU field"
26 _inherit = 'product.product'26 _inherit = 'product.product'
2727 _columns = {'magento_sku':fields.char('Magento SKU', size=64, readonly=True),
28 _columns = {28 }
29 'magento_sku':fields.char('Magento SKU', size=64, readonly=True),29 _defaults = {'magento_sku':lambda obj, cr, uid, context: obj.pool.get('ir.sequence').get(cr, uid, 'product.magento.sku'),
30 }30 }
31
32 _defaults = {
33 'magento_sku':lambda obj, cr, uid, context: obj.pool.get('ir.sequence').get(cr, uid, 'product.magento.sku'),
34 }
3531
36 def copy(self, cr, uid, id, default=None, context=None):32 def copy(self, cr, uid, id, default=None, context=None):
37 default['magento_sku'] = self.pool.get('ir.sequence').get(cr, uid, 'product.magento.sku')33 default['magento_sku'] = self.pool.get('ir.sequence').get(cr, uid, 'product.magento.sku')
38 return super(Product, self).copy(cr, uid, id, default=default, context=context)34 return super(Product, self).copy(cr, uid, id, default=default, context=context)
3935
40Product()
41
4236
=== removed directory 'magento_sku_is_code'
=== removed file 'magento_sku_is_code/__init__.py'
--- magento_sku_is_code/__init__.py 2012-03-15 09:47:04 +0000
+++ magento_sku_is_code/__init__.py 1970-01-01 00:00:00 +0000
@@ -1,22 +0,0 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Author: Guewen Baconnier
5# Copyright 2011-2012 Camptocamp SA
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22import product
230
=== removed file 'magento_sku_is_code/__openerp__.py'
--- magento_sku_is_code/__openerp__.py 2012-03-15 09:47:04 +0000
+++ magento_sku_is_code/__openerp__.py 1970-01-01 00:00:00 +0000
@@ -1,41 +0,0 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Author: Guewen Baconnier
5# Copyright 2011-2012 Camptocamp SA
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22{
23 "name" : "Magento sku is product's code",
24 "version" : "1.0",
25 "depends" : ["base",
26 "product",
27 "magentoerpconnect",],
28 "author" : "Camptocamp",
29 "license": 'AGPL-3',
30 "description": """Use product's code as SKU for Magento.
31 Once exported to Magento, the Magento SKU is not changed, even if you change the product's code.
32""",
33 "website" : "http://www.camptocamp.com",
34 "category" : "Generic Modules",
35 "init_xml" : [],
36 "demo_xml" : [],
37 "update_xml" : ['product_view.xml'],
38 "active": False,
39 "installable": True,
40
41}
420
=== removed directory 'magento_sku_is_code/i18n'
=== removed file 'magento_sku_is_code/product.py'
--- magento_sku_is_code/product.py 2012-03-15 09:47:04 +0000
+++ magento_sku_is_code/product.py 1970-01-01 00:00:00 +0000
@@ -1,66 +0,0 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Author: Guewen Baconnier
5# Copyright 2011-2012 Camptocamp SA
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22from osv import osv, fields
23
24
25class Product(osv.osv):
26 """Inherit product to use the default code as the Magento SKU. Copy the default code into the magento_sku field."""
27 _inherit = 'product.product'
28
29 _columns = {'magento_sku':fields.char('Magento SKU', size=64, readonly=True),}
30
31 _sql_constraints = [('code_uniq', 'unique(default_code)', 'The code must be unique')]
32
33 def _get_sku(self, cr, uid, vals, product=None, context=None):
34 """
35 Returns the SKU value.
36 @param vals: vals to be created / modified
37 @param product: optional browse instance of the product (when writing)
38 """
39 return vals['default_code']
40
41 def create(self, cr, uid, vals, context=None):
42 if vals.get('default_code'):
43 vals['magento_sku'] = self._get_sku(cr, uid, vals, context=context)
44 return super(Product, self).create(cr, uid, vals, context)
45
46 def write(self, cr, uid, ids, vals, context=None):
47 if isinstance(ids, (int, long)):
48 ids = [ids]
49 ids_to_write = ids[:]
50 if vals.get('default_code'):
51 for product in self.browse(cr, uid, ids, context=context):
52 # write separately on each product if they are not already exported
53 if not product.magento_exported:
54 new_vals = vals.copy()
55 new_vals['magento_sku'] = self._get_sku(cr, uid, new_vals, product=product, context=context)
56 super(Product, self).write(cr, uid, [product.id], new_vals, context=context)
57 ids_to_write.remove(product.id)
58
59 return super(Product, self).write(cr, uid, ids_to_write, vals, context=context)
60
61 def copy(self, cr, uid, id, default=None, context=None):
62 if not default is None: default = {}
63 default['default_code'] = False
64 return super(Product, self).copy(cr, uid, id, default=default, context=context)
65
66Product()
670
=== removed file 'magento_sku_is_code/product_view.xml'
--- magento_sku_is_code/product_view.xml 2011-11-28 10:01:34 +0000
+++ magento_sku_is_code/product_view.xml 1970-01-01 00:00:00 +0000
@@ -1,24 +0,0 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data>
4 <record model="ir.ui.view" id="product_product_form_view_magerp_sku">
5 <field name="name">product.normal.form_magerp.sku</field>
6 <field name="model">product.product</field>
7 <field name="type">form</field>
8 <field name="inherit_id" ref="magentoerpconnect.product_product_form_view_magerp"/>
9 <field name="arch" type="xml">
10 <data>
11 <field name="default_code" position="attributes">
12 <attribute name="attrs">{'required':[('magento_exportable','=',True)]}</attribute>
13 </field>
14 <field name="magento_sku" position="attributes">
15 <attribute name="attrs"/>
16 </field>
17 <field name="magento_sku" position="attributes">
18 <attribute name="readonly">True</attribute>
19 </field>
20 </data>
21 </field>
22 </record>
23 </data>
24</openerp>
250
=== removed directory 'magento_sku_is_code/security'
=== modified file 'magentoerpconnect/__openerp__.py'
--- magentoerpconnect/__openerp__.py 2012-05-16 08:01:05 +0000
+++ magentoerpconnect/__openerp__.py 2012-12-03 15:22:20 +0000
@@ -18,14 +18,14 @@
18#########################################################################18#########################################################################
19{19{
20 "name" : "Magento e-commerce",20 "name" : "Magento e-commerce",
21 "version" : "1.0",21 "version" : "6.1.1",
22 "depends" : ["base",22 "depends" : ["base",
23 "product",23 "product",
24 "product_m2mcategories",24 "product_m2mcategories",
25 'delivery',25 'delivery',
26 "base_sale_multichannels",26 "base_sale_multichannels",
27 "product_images_olbs",27 "product_images_olbs",
28 "product_links",28 "product_links_sync",
29 ],29 ],
30 "author" : "MagentoERPconnect Core Editors",30 "author" : "MagentoERPconnect Core Editors",
31 "description": """Magento E-commerce management31 "description": """Magento E-commerce management
3232
=== modified file 'magentoerpconnect/delivery.py'
--- magentoerpconnect/delivery.py 2012-03-27 09:52:57 +0000
+++ magentoerpconnect/delivery.py 2012-12-03 15:22:20 +0000
@@ -19,10 +19,12 @@
19#along with this program. If not, see <http://www.gnu.org/licenses/>. #19#along with this program. If not, see <http://www.gnu.org/licenses/>. #
20#########################################################################20#########################################################################
2121
22from osv import fields,osv22from openerp.osv.orm import Model
23from tools.translate import _23from openerp.osv import fields
24from openerp.osv.osv import except_osv
25from openerp.tools.translate import _
2426
25class delivery_carrier(osv.osv):27class delivery_carrier(Model):
26 _inherit = "delivery.carrier"28 _inherit = "delivery.carrier"
2729
28 def _carrier_code(self, cr, uid, ids, name, args, context=None):30 def _carrier_code(self, cr, uid, ids, name, args, context=None):
@@ -57,7 +59,7 @@
57 carrier = self.read(59 carrier = self.read(
58 cr, uid, id, ['magento_carrier_code', 'name'], context=context)60 cr, uid, id, ['magento_carrier_code', 'name'], context=context)
59 if not carrier['magento_carrier_code'] in mag_carrier.keys():61 if not carrier['magento_carrier_code'] in mag_carrier.keys():
60 raise osv.except_osv(62 raise except_osv(
61 _("Error"),63 _("Error"),
62 _("The carrier %s doesn't have a magento_code valid !"64 _("The carrier %s doesn't have a magento_code valid !"
63 "The value %s is not in the carrier list %s "65 "The value %s is not in the carrier list %s "
6466
=== modified file 'magentoerpconnect/delivery_view.xml'
--- magentoerpconnect/delivery_view.xml 2011-06-07 14:33:14 +0000
+++ magentoerpconnect/delivery_view.xml 2012-12-03 15:22:20 +0000
@@ -10,8 +10,8 @@
10 <field name="arch" type="xml">10 <field name="arch" type="xml">
11 <data>11 <data>
12 <field name="product_id" select="1" position="after">12 <field name="product_id" select="1" position="after">
13 <field name="magento_code"/>13 <field name="magento_code"/>
14 <field name="magento_tracking_title"/>14 <field name="magento_tracking_title"/>
15 </field>15 </field>
16 </data>16 </data>
17 </field>17 </field>
1818
=== modified file 'magentoerpconnect/invoice.py'
--- magentoerpconnect/invoice.py 2012-06-01 17:48:14 +0000
+++ magentoerpconnect/invoice.py 2012-12-03 15:22:20 +0000
@@ -21,26 +21,27 @@
21#along with this program. If not, see <http://www.gnu.org/licenses/>. #21#along with this program. If not, see <http://www.gnu.org/licenses/>. #
22#########################################################################22#########################################################################
2323
24from osv import osv, fields24from openerp.osv.orm import Model
25from tools.translate import _25from openerp.osv import fields
26from openerp.tools.translate import _
27from base_external_referentials.external_osv import ExternalSession
28from openerp.osv.osv import except_osv
2629
27class account_invoice(osv.osv):30class account_invoice(Model):
28 _inherit = "account.invoice"31 _inherit = "account.invoice"
29
30 _columns = {32 _columns = {
31 'magento_ref':fields.char('Magento REF', size=32),33 'magento_ref':fields.char('Magento REF', size=32),
32 }34 }
3335
3436
35#TODO instead of calling again the sale order information 37 #TODO instead of calling again the sale order information
36# it will be better to store the ext_id of each sale order line38 # it will be better to store the ext_id of each sale order line
37#Moreover some code should be share between the partial export of picking and invoice39 #Moreover some code should be share between the partial export of picking and invoice
38
39 def add_invoice_line(self, cr, uid, lines, line, context=None):40 def add_invoice_line(self, cr, uid, lines, line, context=None):
40 """ A line to add in the invoice is a dict with : product_id and product_qty keys."""41 """ A line to add in the invoice is a dict with : product_id and product_qty keys."""
41 line_info = {'product_id': line.product_id.id,42 line_info = {'product_id': line.product_id.id,
42 'product_qty': line.quantity,43 'product_qty': line.quantity,
43 }44 }
44 lines.append(line_info)45 lines.append(line_info)
45 return lines46 return lines
4647
@@ -55,7 +56,7 @@
55 for item in order_items:56 for item in order_items:
56 product_2_item.update({self.pool.get('product.product').get_oeid(cr, uid, item['product_id'],57 product_2_item.update({self.pool.get('product.product').get_oeid(cr, uid, item['product_id'],
57 external_session.referential_id.id, context={}): item['item_id']})58 external_session.referential_id.id, context={}): item['item_id']})
58 59
59 lines = []60 lines = []
60 # get product and quantities to invoice from the invoice61 # get product and quantities to invoice from the invoice
61 for line in invoice.invoice_line:62 for line in invoice.invoice_line:
@@ -70,31 +71,80 @@
70 item_qty.update({product_2_item[line['product_id']]: line['product_qty']})71 item_qty.update({product_2_item[line['product_id']]: line['product_qty']})
71 return item_qty72 return item_qty
7273
74 def map_magento_order(self, cr, uid, external_session, invoice_id, order_increment_id, context=None):
75 #TODO Error should be catch by the external report system (need some improvement before)
76 #For now error are just logged into the OpenERP log file
77 try:
78 external_session.logger.warning('Try to map the invoice with an existing order')
79 invoice_ids = external_session.connection.call('sales_order.get_invoice_ids', [order_increment_id])
80 #TODO support mapping for partiel invoice if needed
81 if len(invoice_ids) == 1:
82 external_session.logger.info(
83 'Success to map the invoice %s with an existing order for the order %s.'
84 %(invoice_ids[0], order_increment_id))
85 return invoice_ids[0]
86 else:
87 external_session.logger.error(
88 'Failed to map the invoice %s with an existing order for the order %s. Too many invoice found'
89 %(invoice_ids[0], order_increment_id))
90 return False
91 except Exception, e:
92 external_session.logger.error(
93 'Failed to map the invoice with an existing order for the order %s. Error : %s'
94 %(order_increment_id, e))
95 return False
96
73 def create_magento_invoice(self, cr, uid, external_session, invoice_id, order_increment_id, context=None):97 def create_magento_invoice(self, cr, uid, external_session, invoice_id, order_increment_id, context=None):
74 item_qty = self.get_invoice_items(cr, uid, external_session, invoice_id, order_increment_id, context=context)98 item_qty = self.get_invoice_items(cr, uid, external_session, invoice_id, order_increment_id, context=context)
75 try:99 try:
76 return external_session.connection.call('sales_order_invoice.create', [order_increment_id,100 return external_session.connection.call('sales_order_invoice.create', [order_increment_id,
77 item_qty, _('Invoice Created'), False, False])101 item_qty, _('Invoice Created'), False, False])
78 except Exception, e:102 except Exception, e:
79 external_session.logger.warning(_('Can not create the invoice for the order %s in the external system. Error : %s')%(order_increment_id, e))103 external_session.logger.warning(
80 return False104 'Can not create the invoice for the order %s in the external system. Error : %s'
105 %(order_increment_id, e))
106 invoice_id = self.map_magento_order(cr, uid, external_session, invoice_id, order_increment_id, context=context)
107 if invoice_id:
108 return invoice_id
109 else:
110 raise except_osv(_('Magento Error'), _('Failed to synchronize Magento invoice with OpenERP invoice'))
81111
82 def ext_create(self, cr, uid, external_session, resources, mapping=None, mapping_id=None, context=None):112 def ext_create(self, cr, uid, external_session, resources, mapping=None, mapping_id=None, context=None):
83 ext_create_ids={}113 ext_create_ids={}
84 for resource_id, resource in resources.items():114 for resource_id, resource in resources.items():
85 resource = resource[resource.keys()[0]]115 res = self.ext_create_one_invoice(cr, uid, external_session, resource_id, resource, context=context)
86 if resource['type'] == 'out_invoice':116 if res:
87 ext_create_ids[resource_id] = self.create_magento_invoice(cr, uid, external_session,117 ext_create_ids[resource_id] = res
88 resource_id, resource['order_increment_id'], context=context)
89 return ext_create_ids118 return ext_create_ids
90119
91account_invoice()120 def ext_create_one_invoice(self, cr, uid, external_session, resource_id, resource, context=None):
92121 resource = resource[resource.keys()[0]]
93122 if resource['type'] == 'out_invoice':
94class account_invoice_line(osv.osv):123 return self.create_magento_invoice(cr, uid, external_session,
95124 resource_id, resource['order_increment_id'], context=context)
125 return False
126
127 def _export_one_invoice(self, cr, uid, invoice, context=None):
128 if invoice.sale_ids:
129 sale = invoice.sale_ids[0]
130 referential = sale.shop_id.referential_id
131 if referential and referential.type_name == 'Magento':
132 ext_id = invoice.get_extid(referential.id)
133 if ext_id:
134 return ext_id
135 else:
136 external_session = ExternalSession(referential, sale.shop_id)
137 return self._export_one_resource(cr, uid, external_session, invoice.id,
138 context=context)
139
140 def export_invoice(self, cr, uid, ids, context=None):
141 for invoice in self .browse(cr, uid, ids, context=context):
142 self._export_one_invoice(cr, uid, invoice, context=context)
143 return True
144
145
146class account_invoice_line(Model):
96 _inherit = 'account.invoice.line'147 _inherit = 'account.invoice.line'
97
98 _columns = {148 _columns = {
99 # Forced the precision of the account.invoice.line discount field149 # Forced the precision of the account.invoice.line discount field
100 # to 3 digits in order to be able to have the same amount as Magento.150 # to 3 digits in order to be able to have the same amount as Magento.
@@ -103,5 +153,4 @@
103 # With a 2 digits precision, we can have 50.17 % => 148.99 or 50.16% => 149.02.153 # With a 2 digits precision, we can have 50.17 % => 148.99 or 50.16% => 149.02.
104 # Force the digits to 3 allows to have 50.167% => 149€154 # Force the digits to 3 allows to have 50.167% => 149€
105 'discount': fields.float('Discount (%)', digits=(16, 3)),155 'discount': fields.float('Discount (%)', digits=(16, 3)),
106 }156 }
107account_invoice_line()
108157
=== modified file 'magentoerpconnect/magerp_core.py'
--- magentoerpconnect/magerp_core.py 2012-05-25 15:37:26 +0000
+++ magentoerpconnect/magerp_core.py 2012-12-03 15:22:20 +0000
@@ -22,24 +22,30 @@
22#along with this program. If not, see <http://www.gnu.org/licenses/>. #22#along with this program. If not, see <http://www.gnu.org/licenses/>. #
23#########################################################################23#########################################################################
2424
25from osv import osv, fields
26import magerp_osv
27import pooler
28import base64, urllib
29from magerp_osv import Connection
30import tools
31from tools.translate import _
32import os25import os
26import logging
27
28from openerp.osv import fields
29from openerp.osv.osv import except_osv
30from openerp import pooler
31from openerp import tools
32from openerp.tools.translate import _
33
34from .magerp_osv import MagerpModel, Connection
33from base_external_referentials.decorator import only_for_referential35from base_external_referentials.decorator import only_for_referential
34from base_external_referentials.external_osv import ExternalSession36from base_external_referentials.external_osv import ExternalSession
3537
36import logging38from base_external_referentials.external_referentials import REF_VISIBLE_FIELDS
39
40REF_VISIBLE_FIELDS['Magento'] = ['location', 'apiusername', 'apipass']
41
42
37_logger = logging.getLogger(__name__)43_logger = logging.getLogger(__name__)
3844
39DEBUG = True45DEBUG = True
40TIMEOUT = 246TIMEOUT = 2
4147
42class external_referential(magerp_osv.magerp_osv):48class external_referential(MagerpModel):
43 #This class stores instances of magento to which the ERP will connect, so you can connect OpenERP to multiple Magento installations (eg different Magento databases)49 #This class stores instances of magento to which the ERP will connect, so you can connect OpenERP to multiple Magento installations (eg different Magento databases)
44 _inherit = "external.referential"50 _inherit = "external.referential"
4551
@@ -209,7 +215,7 @@
209 if lang_id:215 if lang_id:
210 lang = lang_id.code216 lang = lang_id.code
211 else:217 else:
212 osv.except_osv(_('Warning!'), _('The storeviews have no language defined'))218 except_osv(_('Warning!'), _('The storeviews have no language defined')) #TODO needed?
213 lang = referential.default_lang_id.code219 lang = referential.default_lang_id.code
214 if not lang_2_storeview.get(lang, False):220 if not lang_2_storeview.get(lang, False):
215 lang_2_storeview[lang] = storeview221 lang_2_storeview[lang] = storeview
@@ -282,6 +288,7 @@
282 shop.export_products(cr, uid, shop, context)288 shop.export_products(cr, uid, shop, context)
283 return True289 return True
284290
291 #TODO refactor me
285 def sync_partner(self, cr, uid, ids, context=None):292 def sync_partner(self, cr, uid, ids, context=None):
286 def next_partners(connection, start, step):293 def next_partners(connection, start, step):
287 filters = {'customer_id': {'in': range(start, start + step)}}294 filters = {'customer_id': {'in': range(start, start + step)}}
@@ -308,11 +315,10 @@
308 address_info = customer_address_info[0]315 address_info = customer_address_info[0]
309 address_info['customer_id'] = ext_customer_id316 address_info['customer_id'] = ext_customer_id
310 address_info['email'] = customer_info['email']317 address_info['email'] = customer_info['email']
311318 external_session = ExternalSession(referential, referential)
312 self.pool.get('res.partner').ext_import(import_cr, uid, [customer_info], referential.id, context=context)319 self.pool.get('res.partner')._record_one_external_resource(import_cr, uid, external_session, customer_info, context=context)
313 if address_info:320 if address_info:
314 self.pool.get('res.partner.address').ext_import(import_cr, uid, [address_info], referential.id, context=context)321 self.pool.get('res.partner.address')._record_one_external_resource(import_cr, uid, external_session, address_info, context=context)
315
316 last_imported_id = int(ext_customer_id)322 last_imported_id = int(ext_customer_id)
317 self.write(import_cr, uid, referential.id, {'last_imported_partner_id': last_imported_id}, context=context)323 self.write(import_cr, uid, referential.id, {'last_imported_partner_id': last_imported_id}, context=context)
318 import_cr.commit()324 import_cr.commit()
@@ -382,10 +388,8 @@
382 if DEBUG:388 if DEBUG:
383 print "run_import_newsletter_unsubscriber_scheduler: %s" % referential_ids389 print "run_import_newsletter_unsubscriber_scheduler: %s" % referential_ids
384390
385external_referential()391
386392class external_shop_group(MagerpModel):
387
388class external_shop_group(magerp_osv.magerp_osv):
389 _inherit = "external.shop.group"393 _inherit = "external.shop.group"
390 #Return format of API:{'code': 'base', 'name': 'Main', 'website_id': '1', 'is_default': '1', 'sort_order': '0', 'default_group_id': '1'}394 #Return format of API:{'code': 'base', 'name': 'Main', 'website_id': '1', 'is_default': '1', 'sort_order': '0', 'default_group_id': '1'}
391 # default_group_id is the default shop of the external_shop_group (external_shop_group = website)395 # default_group_id is the default shop of the external_shop_group (external_shop_group = website)
@@ -407,12 +411,10 @@
407 'default_shop_integer_id':fields.integer('Default Store'), #This field can't be a many2one because shop_group field will be mapped before creating Shop (Shop = Store, shop_group = website)411 'default_shop_integer_id':fields.integer('Default Store'), #This field can't be a many2one because shop_group field will be mapped before creating Shop (Shop = Store, shop_group = website)
408 'default_shop_id':fields.function(_get_default_shop_id, type="many2one", relation="sale.shop", method=True, string="Default Store"),412 'default_shop_id':fields.function(_get_default_shop_id, type="many2one", relation="sale.shop", method=True, string="Default Store"),
409 'referential_type' : fields.related('referential_id', 'type_id', type='many2one', relation='external.referential.type', string='External Referential Type'),413 'referential_type' : fields.related('referential_id', 'type_id', type='many2one', relation='external.referential.type', string='External Referential Type'),
410 }414 }
411415
412external_shop_group()416
413417class magerp_storeviews(MagerpModel):
414
415class magerp_storeviews(magerp_osv.magerp_osv):
416 _name = "magerp.storeviews"418 _name = "magerp.storeviews"
417 _description = "The magento store views information"419 _description = "The magento store views information"
418420
@@ -427,5 +429,3 @@
427 }429 }
428430
429 #Return format of API:{'code': 'default', 'store_id': '1', 'website_id': '1', 'is_active': '1', 'sort_order': '0', 'group_id': '1', 'name': 'Default Store View'}431 #Return format of API:{'code': 'default', 'store_id': '1', 'website_id': '1', 'is_active': '1', 'sort_order': '0', 'group_id': '1', 'name': 'Default Store View'}
430
431magerp_storeviews()
432432
=== modified file 'magentoerpconnect/magerp_core_view.xml'
--- magentoerpconnect/magerp_core_view.xml 2012-05-19 12:23:36 +0000
+++ magentoerpconnect/magerp_core_view.xml 2012-12-03 15:22:20 +0000
@@ -1,172 +1,168 @@
1<?xml version="1.0" encoding="utf-8"?>1<?xml version="1.0" encoding="utf-8"?>
2<openerp>2<openerp>
3 <data>3 <data>
4 <!--Magento Instances Tree/Form view -->4 <!--Magento Instances Tree/Form view -->
55
6 <record model="ir.ui.view" id="magerp_instances_form">6 <record model="ir.ui.view" id="magerp_instances_form">
7 <field name="name">External Referentials</field>7 <field name="name">External Referentials</field>
8 <field name="model">external.referential</field>8 <field name="model">external.referential</field>
9 <field name="inherit_id" ref="base_external_referentials.external_referential_form_view" />9 <field name="inherit_id" ref="base_external_referentials.external_referential_form_view" />
10 <field name="type">form</field>10 <field name="type">form</field>
11 <field name="priority">30</field>11 <field name="priority">30</field>
12 <field name="arch" type="xml">12 <field name="arch" type="xml">
13 <xpath expr="/form/group[2]/notebook/page[@string='Referential Actions']" position="replace">13 <group name="compulsory" position="after">
14 <page string="Referential Actions">14 <group name="magento" col="4" colspan="4" attrs="{'invisible': [['type_name', '!=', 'Magento']]}">
15 <separator string="Compulsory" colspan="4" />15 <separator string="Optional - Initial import only" colspan="4" />
16 <button name="refresh_mapping" string="1 - Reload Referential Mapping Templates" colspan="2" type="object" />16 <button name="import_customer_groups" string="1 - Import Customer Groups (Partner Categories)" colspan="2" type="object" />
17 <button name="import_referentials" string="2 - Synchronize Referential Settings" colspan="2" type="object" attrs="{'readonly':[('mapping_ids','=',[])]}"/>17 <group colspan="2" col="12">
18 <separator string="Optional - Initial import only" colspan="4" />18 <button name="sync_attribs" string="5 - Import Product Attributes" colspan="10" type="object" />
19 <button name="import_customer_groups" string="1 - Import Customer Groups (Partner Categories)" colspan="2" type="object" />19 <field name="import_all_attributs"/>
20 <group colspan="2" col="12">20 </group>
21 <button name="sync_attribs" string="5 - Import Product Attributes" colspan="10" type="object" />21 <button name="import_product_categories" string="2 - Import Product Categories" colspan="2" type="object" />
22 <field name="import_all_attributs"/>22 <group colspan="2" col="14">
23 </group>
24 <button name="import_product_categories" string="2 - Import Product Categories" colspan="2" type="object" />
25 <group colspan="2" col="14">
26 <group colspan="8">23 <group colspan="8">
27 <button name="sync_products" string="6 - Import Products" type="object" attrs="{'invisible':[('import_image_with_product','=',True)]}" />24 <button name="sync_products" string="6 - Import Products" type="object" attrs="{'invisible':[('import_image_with_product','=',True)]}" />
28 <button name="sync_products" string="6 - Import Products And Images" type="object" attrs="{'invisible':[('import_image_with_product','=',False)]}" />25 <button name="sync_products" string="6 - Import Products And Images" type="object" attrs="{'invisible':[('import_image_with_product','=',False)]}" />
29 </group>26 </group>
30 <field name="import_image_with_product"/>27 <field name="import_image_with_product"/>
31 <field name="import_links_with_product"/>28 <field name="import_links_with_product"/>
32 <field name="last_imported_product_id" string=""/>29 <field name="last_imported_product_id" string=""/>
33 </group>30 </group>
34 <button name="sync_attrib_sets" string="3 - Import Product Attribute Sets" colspan="2" type="object" />31 <button name="sync_attrib_sets" string="3 - Import Product Attribute Sets" colspan="2" type="object" />
35 <button name="sync_images" string="7 - Import Images" colspan="2" type="object" attrs="{'invisible':[('import_image_with_product','=',True)]}"/>32 <button name="sync_images" string="7 - Import Images" colspan="2" type="object" attrs="{'invisible':[('import_image_with_product','=',True)]}"/>
36 <button name="sync_attrib_groups" string="4 - Import Attribute Groups" colspan="2" type="object" />33 <button name="sync_attrib_groups" string="4 - Import Attribute Groups" colspan="2" type="object" />
37 <button name="sync_product_links" string="8 - Import Product Links" colspan="2" type="object" />34 <button name="sync_product_links" string="8 - Import Product Links" colspan="2" type="object" />
38 <separator string="Default values" colspan="4" />35 <separator string="Default values" colspan="4" />
39 <field name="default_pro_cat" required="1"/>36 <field name="default_pro_cat" attrs="{'required': [['type_name', '=', 'Magento']]}"/>
40 <field name="default_lang_id" required="1"/>37 <field name="default_lang_id" attrs="{'required': [['type_name', '=', 'Magento']]}"/>
41<!-- <button name="sync_customer_addresses" string="Sync Customer Addresses" colspan="2" type="object" />-->38 </group>
42<!-- <button name="export_products" string="Export Products" colspan="2" type="object" />-->39 </group>
43 </page>
44 </xpath>
4540
46 <xpath expr="/form/group[2]/notebook" position="inside">41 <notebook position="inside">
47 <page string="Websites">42 <page string="Websites" attrs="{'invisible': [['type_name', '!=', 'Magento']]}">
48 <field name="shop_group_ids" nolabel="1" />43 <field name="shop_group_ids" nolabel="1" />
49 </page>44 </page>
50 <!-- <page string="Store Views">45 <!-- <page string="Store Views">
51 <field name="storeviews" nolabel="1" />46 <field name="storeviews" nolabel="1" />
52 </page>47 </page>
53 <page string="Groups (Stores)">48 <page string="Groups (Stores)">
54 <field name="shop_ids" nolabel="1" />49 <field name="shop_ids" nolabel="1" />
55 </page>-->50 </page>-->
56 <page string="Product Attributes / Sets">51 <page string="Product Attributes / Sets" attrs="{'invisible': [['type_name', '!=', 'Magento']]}">
57 <newline />52 <newline />
58 <field name="attribute_sets" nolabel="1" colspan="4"/>53 <field name="attribute_sets" nolabel="1" colspan="4"/>
59 </page>54 </page>
60 <page string="Advanced">55 <page string="Advanced" attrs="{'invisible': [['type_name', '!=', 'Magento']]}">
61 <separator string="Partner" colspan="4"/>56 <separator string="Partner" colspan="4"/>
62 <group colspan="2" col="12">57 <group colspan="2" col="12">
63 <button name="sync_partner" string="Import All Partners" colspan="10" type="object" />58 <button name="sync_partner" string="Import All Partners" colspan="10" type="object" />
64 <field name="last_imported_partner_id" string=""/>59 <field name="last_imported_partner_id" string=""/>
65 </group>60 </group>
66 <button name="sync_newsletter" string="Import Newsletter Subscribers" colspan="2" type="object" />61 <button name="sync_newsletter" string="Import Newsletter Subscribers" colspan="2" type="object" />
67 <button name="sync_newsletter_unsubscriber" string="Export Newsletter UnSubscribers" colspan="2" type="object" />62 <button name="sync_newsletter_unsubscriber" string="Export Newsletter UnSubscribers" colspan="2" type="object" />
68 <separator string="Others" colspan="4"/>63 <separator string="Others" colspan="4"/>
69 <field name="active" select="2"/>64 <field name="active" select="2"/>
70 </page>65 </page>
71 </xpath>66 </notebook>
72 </field>67 </field>
73 </record>68 </record>
74 <record id="act_magerp_instances_form" model="ir.actions.act_window">69 <record id="act_magerp_instances_form" model="ir.actions.act_window">
75 <field name="name">Magento Instances</field>70 <field name="name">Magento Instances</field>
76 <field name="res_model">external.referential</field>71 <field name="res_model">external.referential</field>
77 <field name="type">ir.actions.act_window</field>72 <field name="type">ir.actions.act_window</field>
78 <field name="view_type">form</field>73 <field name="view_type">form</field>
79 <field name="view_mode">tree,form</field>74 <field name="view_mode">tree,form</field>
80 <field name="view_id" ref="base_external_referentials.external_referential_tree_view" />75 <field name="view_id" ref="base_external_referentials.external_referential_tree_view" />
81 </record>76 <field name="domain">[['type_name', '=', 'Magento']]</field>
8277 </record>
83 <!--Magento Websites Tree/Form view -->78
84 <record model="ir.ui.view" id="magerp_websites_form">79 <!--Magento Websites Tree/Form view -->
85 <field name="name">external.shop.group.form</field>80 <record model="ir.ui.view" id="magerp_websites_form">
86 <field name="model">external.shop.group</field>81 <field name="name">external.shop.group.form</field>
87 <field name="type">form</field>82 <field name="model">external.shop.group</field>
88 <field name="arch" type="xml">83 <field name="type">form</field>
89 <form string="Magento websites">84 <field name="arch" type="xml">
90 <group col="4" colspan="4">85 <form string="Magento websites">
91 <field name="name" readonly="1" />86 <group col="4" colspan="4">
92 <field name="code" readonly="1" />87 <field name="name" readonly="1" />
93 <field name="is_default" readonly="1" />88 <field name="code" readonly="1" />
94 <field name="sort_order" readonly="1" />89 <field name="is_default" readonly="1" />
95 <field name="default_shop_id" readonly="1" />90 <field name="sort_order" readonly="1" />
96 <field name="referential_id" readonly="1" />91 <field name="default_shop_id" readonly="1" />
97 </group>92 <field name="referential_id" readonly="1" />
98 <group col="4" colspan="4">93 </group>
99 <field name="shop_ids" readonly="1"/>94 <group col="4" colspan="4">
100 </group>95 <field name="shop_ids" readonly="1"/>
101 </form>96 </group>
102 </field>97 </form>
103 </record>98 </field>
104 <record model="ir.ui.view" id="magerp_websites_tree">99 </record>
105 <field name="name">external.shop.group.tree</field>100 <record model="ir.ui.view" id="magerp_websites_tree">
106 <field name="model">external.shop.group</field>101 <field name="name">external.shop.group.tree</field>
107 <field name="type">tree</field>102 <field name="model">external.shop.group</field>
108 <field name="arch" type="xml">103 <field name="type">tree</field>
109 <tree string="Magento websites">104 <field name="arch" type="xml">
110 <field name="name" readonly="1" select="1" />105 <tree string="Magento websites">
111 <field name="code" readonly="1" select="1" />106 <field name="name" readonly="1" select="1" />
112 <field name="is_default" readonly="1" select="2" />107 <field name="code" readonly="1" select="1" />
113 <field name="sort_order" readonly="1" select="2" />108 <field name="is_default" readonly="1" select="2" />
114 <field name="default_shop_id" readonly="1" select="2" />109 <field name="sort_order" readonly="1" select="2" />
115 <field name="shop_ids" readonly="1" />110 <field name="default_shop_id" readonly="1" select="2" />
116 </tree>111 <field name="shop_ids" readonly="1" />
117 </field>112 </tree>
118 </record>113 </field>
119 <record id="act_magerp_websites_form" model="ir.actions.act_window">114 </record>
120 <field name="name">Magento websites</field>115 <record id="act_magerp_websites_form" model="ir.actions.act_window">
121 <field name="res_model">external.shop.group</field>116 <field name="name">Magento websites</field>
122 <field name="type">ir.actions.act_window</field>117 <field name="res_model">external.shop.group</field>
123 <field name="view_type">form</field>118 <field name="type">ir.actions.act_window</field>
124 <field name="view_mode">tree,form</field>119 <field name="view_type">form</field>
125 <field name="view_id" ref="magerp_websites_tree" />120 <field name="view_mode">tree,form</field>
126 </record>121 <field name="view_id" ref="magerp_websites_tree" />
127122 </record>
128 <!--Magento storeviews Tree/Form view -->123
129 <record model="ir.ui.view" id="magerp_storeviews_form">124 <!--Magento storeviews Tree/Form view -->
130 <field name="name">magerp.storeviews.form</field>125 <record model="ir.ui.view" id="magerp_storeviews_form">
131 <field name="model">magerp.storeviews</field>126 <field name="name">magerp.storeviews.form</field>
132 <field name="type">form</field>127 <field name="model">magerp.storeviews</field>
133 <field name="arch" type="xml">128 <field name="type">form</field>
134 <form string="Magento storeviews">129 <field name="arch" type="xml">
135 <group col="4" colspan="4">130 <form string="Magento storeviews">
136 <field name="name" readonly="1" />131 <group col="4" colspan="4">
137 <field name="code" readonly="1" />132 <field name="name" readonly="1" />
138 <field name="shop_id" readonly="1" />133 <field name="code" readonly="1" />
139 <field name="website_id" readonly="1" />134 <field name="shop_id" readonly="1" />
140 <field name="is_active" readonly="1" />135 <field name="website_id" readonly="1" />
141 <field name="sort_order" readonly="1" />136 <field name="is_active" readonly="1" />
142 <field name="lang_id" />137 <field name="sort_order" readonly="1" />
143 </group>138 <field name="lang_id" />
144 </form>139 </group>
145 </field>140 </form>
146 </record>141 </field>
147 <record model="ir.ui.view" id="magerp_storeviews_tree">142 </record>
148 <field name="name">magerp.storeviews.tree</field>143 <record model="ir.ui.view" id="magerp_storeviews_tree">
149 <field name="model">magerp.storeviews</field>144 <field name="name">magerp.storeviews.tree</field>
150 <field name="type">tree</field>145 <field name="model">magerp.storeviews</field>
151 <field name="arch" type="xml">146 <field name="type">tree</field>
152 <tree string="Magento storeviews">147 <field name="arch" type="xml">
153 <field name="name" readonly="1" select="1" />148 <tree string="Magento storeviews">
154 <field name="code" readonly="1" select="1" />149 <field name="name" readonly="1" select="1" />
155 <field name="shop_id" readonly="1" select="1" />150 <field name="code" readonly="1" select="1" />
156 <field name="is_active" readonly="1" select="2" />151 <field name="shop_id" readonly="1" select="1" />
157 <field name="sort_order" readonly="1" select="2" />152 <field name="is_active" readonly="1" select="2" />
158 <field name="lang_id" />153 <field name="sort_order" readonly="1" select="2" />
159 </tree>154 <field name="lang_id" />
160 </field>155 </tree>
161 </record>156 </field>
162 <record id="act_magerp_storeviews_form" model="ir.actions.act_window">157 </record>
163 <field name="name">Magento storeviews</field>158 <record id="act_magerp_storeviews_form" model="ir.actions.act_window">
164 <field name="res_model">magerp.storeviews</field>159 <field name="name">Magento storeviews</field>
165 <field name="type">ir.actions.act_window</field>160 <field name="res_model">magerp.storeviews</field>
166 <field name="view_type">form</field>161 <field name="type">ir.actions.act_window</field>
167 <field name="view_mode">tree,form</field>162 <field name="view_type">form</field>
168 <field name="view_id" ref="magerp_storeviews_tree" />163 <field name="view_mode">tree,form</field>
169 </record>164 <field name="view_id" ref="magerp_storeviews_tree" />
170165 </record>
171 </data>166
167 </data>
172</openerp>168</openerp>
173169
=== modified file 'magentoerpconnect/magerp_data.xml'
--- magentoerpconnect/magerp_data.xml 2012-06-21 17:33:57 +0000
+++ magentoerpconnect/magerp_data.xml 2012-12-03 15:22:20 +0000
@@ -1,7 +1,7 @@
1<?xml version="1.0"?>1<?xml version="1.0"?>
2<openerp>2<openerp>
3 <data noupdate="1">3 <data noupdate="1">
4 4
55
6 <record forcecreate="True" id="ir_cron_import_orders_scheduler_action" model="ir.cron">6 <record forcecreate="True" id="ir_cron_import_orders_scheduler_action" model="ir.cron">
7 <field name="name">Magento Import Orders</field>7 <field name="name">Magento Import Orders</field>
@@ -122,15 +122,15 @@
122<!--122<!--
123123
124 <record id="payment_type1" model="base.sale.payment.type">124 <record id="payment_type1" model="base.sale.payment.type">
125 <field name="name">checkmo;cashondelivery</field>125 <field name="name">checkmo;cashondelivery</field>
126 <field name="order_policy">manual</field>126 <field name="order_policy">manual</field>
127 </record>127 </record>
128 128
129 <record id="payment_type2" model="base.sale.payment.type">129 <record id="payment_type2" model="base.sale.payment.type">
130 <field name="name">ccsave;free;googlecheckout;paypayl_express;paybox_system;paypal_standard;servired_standard;bbva;cofidis</field>130 <field name="name">ccsave;free;googlecheckout;paypayl_express;paybox_system;paypal_standard;servired_standard;bbva;cofidis</field>
131 <field name="order_policy">prepaid</field>131 <field name="order_policy">prepaid</field>
132 </record>132 </record>
133133
134-->134-->
135 </data>135 </data>
136</openerp>136</openerp>
137137
=== modified file 'magentoerpconnect/magerp_menu.xml'
--- magentoerpconnect/magerp_menu.xml 2012-07-13 11:39:38 +0000
+++ magentoerpconnect/magerp_menu.xml 2012-12-03 15:22:20 +0000
@@ -2,7 +2,7 @@
2<openerp>2<openerp>
3 <data>3 <data>
4 <menuitem id="menu_magerp" name="MagentoERPconnect" icon="terp-sale"4 <menuitem id="menu_magerp" name="MagentoERPconnect" icon="terp-sale"
5 web_icon="images/magento.png" 5 web_icon="images/magento.png"
6 web_icon_hover="images/magento-hover.png"/>6 web_icon_hover="images/magento-hover.png"/>
77
8 <menuitem id="menu_magerp_core" name="Core Settings" parent="menu_magerp" />8 <menuitem id="menu_magerp_core" name="Core Settings" parent="menu_magerp" />
99
=== modified file 'magentoerpconnect/magerp_osv.py'
--- magentoerpconnect/magerp_osv.py 2012-05-24 20:52:38 +0000
+++ magentoerpconnect/magerp_osv.py 2012-12-03 15:22:20 +0000
@@ -21,7 +21,6 @@
21#########################################################################21#########################################################################
2222
23import time23import time
24import datetime
25import xmlrpclib24import xmlrpclib
26import urllib225import urllib2
27import base6426import base64
@@ -30,7 +29,9 @@
3029
31#NEW FEATURE30#NEW FEATURE
3231
33from osv import osv, fields32from openerp.osv.orm import Model
33from openerp.osv.osv import except_osv
34from openerp import tools
34from base_external_referentials.decorator import only_for_referential35from base_external_referentials.decorator import only_for_referential
35from base_external_referentials.decorator import open_report36from base_external_referentials.decorator import open_report
36from base_external_referentials.decorator import catch_error_in_report37from base_external_referentials.decorator import catch_error_in_report
@@ -38,42 +39,42 @@
38import logging39import logging
39_logger = logging.getLogger(__name__)40_logger = logging.getLogger(__name__)
4041
41osv.osv.mag_transform_and_send_one_resource = osv.osv._transform_and_send_one_resource42Model.mag_transform_and_send_one_resource = Model._transform_and_send_one_resource
4243
43@only_for_referential('magento', super_function = osv.osv.mag_transform_and_send_one_resource)44@only_for_referential('magento', super_function = Model.mag_transform_and_send_one_resource)
44@catch_error_in_report45@catch_error_in_report
45def _transform_and_send_one_resource(self, cr, uid, external_session, *args, **kwargs):46def _transform_and_send_one_resource(self, cr, uid, external_session, *args, **kwargs):
46 return self.mag_transform_and_send_one_resource(cr, uid, external_session, *args, **kwargs)47 return self.mag_transform_and_send_one_resource(cr, uid, external_session, *args, **kwargs)
4748
48osv.osv._transform_and_send_one_resource = _transform_and_send_one_resource49Model._transform_and_send_one_resource = _transform_and_send_one_resource
4950
5051
51osv.osv.mag_export_resources = osv.osv._export_resources52Model.mag_export_resources = Model._export_resources
5253
53@only_for_referential('magento', super_function = osv.osv.mag_export_resources)54@only_for_referential('magento', super_function = Model.mag_export_resources)
54@open_report55@open_report
55def _export_resources(self, *args, **kwargs):56def _export_resources(self, *args, **kwargs):
56 return self.mag_export_resources( *args, **kwargs)57 return self.mag_export_resources( *args, **kwargs)
57osv.osv._export_resources = _export_resources58Model._export_resources = _export_resources
5859
5960
60osv.osv._mag_get_external_resource_ids = osv.osv._get_external_resource_ids61Model._mag_get_external_resource_ids = Model._get_external_resource_ids
6162
62@only_for_referential('magento', super_function = osv.osv._get_external_resource_ids)63@only_for_referential('magento', super_function = Model._get_external_resource_ids)
63def _get_external_resource_ids(self, cr, uid, external_session, resource_filter=None, mapping=None, mapping_id=None, context=None):64def _get_external_resource_ids(self, cr, uid, external_session, resource_filter=None, mapping=None, mapping_id=None, context=None):
64 mapping, mapping_id = self._init_mapping(cr, uid, external_session.referential_id.id, mapping=mapping, mapping_id=mapping_id, context=context)65 mapping, mapping_id = self._init_mapping(cr, uid, external_session.referential_id.id, mapping=mapping, mapping_id=mapping_id, context=context)
65 ext_resource = mapping[mapping_id]['external_resource_name']66 ext_resource = mapping[mapping_id]['external_resource_name']
66 search_method = mapping[mapping_id]['external_search_method']67 search_method = mapping[mapping_id]['external_search_method']
67 if not search_method:68 if not search_method:
68 #TODO don't forget to replace model by nam ewhen name will be implemented69 #TODO don't forget to replace model by name when name will be implemented
69 raise osv.except_osv(_('User Error'), _('There is not search method for the mapping %s')%(mapping[mapping_id]['model'],))70 raise except_osv(_('User Error'), _('There is not search method for the mapping %s')%(mapping[mapping_id]['model'],))
70 return external_session.connection.call(search_method, [resource_filter])71 return external_session.connection.call(search_method, [resource_filter])
7172
72osv.osv._get_external_resource_ids = _get_external_resource_ids73Model._get_external_resource_ids = _get_external_resource_ids
7374
74osv.osv._mag_get_external_resources = osv.osv._get_external_resources75Model._mag_get_external_resources = Model._get_external_resources
7576
76@only_for_referential('magento', super_function = osv.osv._mag_get_external_resources)77@only_for_referential('magento', super_function = Model._mag_get_external_resources)
77def _get_external_resources(self, cr, uid, external_session, external_id=None, resource_filter=None, mapping=None, mapping_id=None, fields=None, context=None):78def _get_external_resources(self, cr, uid, external_session, external_id=None, resource_filter=None, mapping=None, mapping_id=None, fields=None, context=None):
78 mapping, mapping_id = self._init_mapping(cr, uid, external_session.referential_id.id, mapping=mapping, mapping_id=mapping_id, context=context)79 mapping, mapping_id = self._init_mapping(cr, uid, external_session.referential_id.id, mapping=mapping, mapping_id=mapping_id, context=context)
79 ext_resource = mapping[mapping_id]['external_resource_name']80 ext_resource = mapping[mapping_id]['external_resource_name']
@@ -81,7 +82,7 @@
81 read_method = mapping[mapping_id]['external_get_method']82 read_method = mapping[mapping_id]['external_get_method']
82 if not read_method:83 if not read_method:
83 #TODO don't forget to replace model by nam ewhen name will be implemented84 #TODO don't forget to replace model by nam ewhen name will be implemented
84 raise osv.except_osv(_('User Error'),85 raise except_osv(_('User Error'),
85 _('There is no "Get Method" configured on the mapping %s') %86 _('There is no "Get Method" configured on the mapping %s') %
86 mapping[mapping_id]['model'])87 mapping[mapping_id]['model'])
87 return external_session.connection.call(read_method, [external_id])88 return external_session.connection.call(read_method, [external_id])
@@ -89,16 +90,16 @@
89 search_read_method = mapping[mapping_id]['external_list_method']90 search_read_method = mapping[mapping_id]['external_list_method']
90 if not search_read_method:91 if not search_read_method:
91 #TODO don't forget to replace model by nam ewhen name will be implemented92 #TODO don't forget to replace model by nam ewhen name will be implemented
92 raise osv.except_osv(_('User Error'),93 raise except_osv(_('User Error'),
93 _('There is no "List Method" configured on the mapping %s') %94 _('There is no "List Method" configured on the mapping %s') %
94 mapping[mapping_id]['model'])95 mapping[mapping_id]['model'])
95 return external_session.connection.call(search_read_method, [resource_filter or {}])96 return external_session.connection.call(search_read_method, [resource_filter or {}])
9697
97osv.osv._get_external_resources = _get_external_resources98Model._get_external_resources = _get_external_resources
9899
99osv.osv._mag_ext_create = osv.osv.ext_create100Model._mag_ext_create = Model.ext_create
100101
101@only_for_referential('magento', super_function = osv.osv._mag_ext_create)102@only_for_referential('magento', super_function = Model._mag_ext_create)
102def ext_create(self, cr, uid, external_session, resources, mapping, mapping_id, context=None):103def ext_create(self, cr, uid, external_session, resources, mapping, mapping_id, context=None):
103 ext_create_ids = {}104 ext_create_ids = {}
104 main_lang = context['main_lang']105 main_lang = context['main_lang']
@@ -107,11 +108,11 @@
107 ext_create_ids[resource_id] = ext_id108 ext_create_ids[resource_id] = ext_id
108 return ext_create_ids109 return ext_create_ids
109110
110osv.osv.ext_create = ext_create111Model.ext_create = ext_create
111112
112113
113osv.osv._mag_ext_update= osv.osv.ext_update114Model._mag_ext_update= Model.ext_update
114@only_for_referential('magento', super_function = osv.osv._mag_ext_update)115@only_for_referential('magento', super_function = Model._mag_ext_update)
115def ext_update(self, cr, uid, external_session, resources, mapping=None, mapping_id=None, context=None):116def ext_update(self, cr, uid, external_session, resources, mapping=None, mapping_id=None, context=None):
116 if not mapping[mapping_id]['external_update_method']:117 if not mapping[mapping_id]['external_update_method']:
117 external_session.logger.warning(_("Not update method for mapping %s")%mapping[mapping_id]['model'])118 external_session.logger.warning(_("Not update method for mapping %s")%mapping[mapping_id]['model'])
@@ -124,9 +125,9 @@
124 [ext_id, resource[main_lang]])125 [ext_id, resource[main_lang]])
125 return True126 return True
126127
127osv.osv.ext_update = ext_update128Model.ext_update = ext_update
128129
129#@only_for_referential('magento', super_function = osv.osv.send_to_external)130#@only_for_referential('magento', super_function = Model.send_to_external)
130#def send_to_external(self, cr, uid, external_session, resource, update_date, context=None):131#def send_to_external(self, cr, uid, external_session, resource, update_date, context=None):
131# print 'send this data to the external system', update_date132# print 'send this data to the external system', update_date
132# print 'data', resource133# print 'data', resource
@@ -134,14 +135,14 @@
134# import pdb; pdb.set_trace()135# import pdb; pdb.set_trace()
135# return True136# return True
136137
137#osv.osv.send_to_external = send_to_external138#Model.send_to_external = send_to_external
138139
139140
140#osv.osv.ori_mag_init_context_before_exporting_resource = osv.osv.init_context_before_exporting_resource141#Model.ori_mag_init_context_before_exporting_resource = Model.init_context_before_exporting_resource
141142
142#@only_for_referential('magento', super_function = osv.osv.init_context_before_exporting_resource)143#@only_for_referential('magento', super_function = Model.init_context_before_exporting_resource)
143#def init_context_before_exporting_resource(self, cr, uid, object_id, resource_name, context=None):144#def init_context_before_exporting_resource(self, cr, uid, object_id, resource_name, context=None):
144# context = osv.osv.ori_mag_init_context_before_exporting_resource(cr, uid, object_id, resource_name, context=context)145# context = Model.ori_mag_init_context_before_exporting_resource(cr, uid, object_id, resource_name, context=context)
145# if self._name == 'external.referential':146# if self._name == 'external.referential':
146# referential = self.browse(cr, uid, object_id, context=context)147# referential = self.browse(cr, uid, object_id, context=context)
147# elif 'referential_id' in self._columns.keys():148# elif 'referential_id' in self._columns.keys():
@@ -155,7 +156,7 @@
155# context['store_to_lang'][storeview.id] = storeview.lang_id.code156# context['store_to_lang'][storeview.id] = storeview.lang_id.code
156# return context157# return context
157158
158#osv.osv.init_context_before_exporting_resource = osv.osv.init_context_before_exporting_resource159#Model.init_context_before_exporting_resource = Model.init_context_before_exporting_resource
159160
160161
161def ext_set_resource_as_imported(self, cr, uid, external_session, external_id, mapping=None, mapping_id=None, context=None):162def ext_set_resource_as_imported(self, cr, uid, external_session, external_id, mapping=None, mapping_id=None, context=None):
@@ -165,7 +166,7 @@
165 return external_session.connection.call(done_method, [external_id])166 return external_session.connection.call(done_method, [external_id])
166 return False167 return False
167168
168osv.osv.ext_set_resource_as_imported = ext_set_resource_as_imported169Model.ext_set_resource_as_imported = ext_set_resource_as_imported
169170
170#DEPRECATED FEATURE!! YES ALL FUNCTION UNDER HIS LINE ARE DEPRECATED171#DEPRECATED FEATURE!! YES ALL FUNCTION UNDER HIS LINE ARE DEPRECATED
171172
@@ -175,7 +176,7 @@
175 def __init__(self, location, username, password, debug=False, logger=False):176 def __init__(self, location, username, password, debug=False, logger=False):
176 #Append / if not there177 #Append / if not there
177 if not location[-1] == '/':178 if not location[-1] == '/':
178 location += '/' 179 location += '/'
179 self.corelocation = location180 self.corelocation = location
180 #Please do not remove the str indeed xmlrpc lib require a string for the location181 #Please do not remove the str indeed xmlrpc lib require a string for the location
181 #if an unicode is send it will raise you an error182 #if an unicode is send it will raise you an error
@@ -186,7 +187,7 @@
186 self.result = {}187 self.result = {}
187 self.logger = logger or _logger188 self.logger = logger or _logger
188189
189 190
190 def connect(self):191 def connect(self):
191 if not self.location[-1] == '/':192 if not self.location[-1] == '/':
192 self.location += '/'193 self.location += '/'
@@ -206,11 +207,11 @@
206 except Exception,e:207 except Exception,e:
207 self.logger.error("Magento Connection" + netsvc.LOG_ERROR + "Error in connecting:%s" % e)208 self.logger.error("Magento Connection" + netsvc.LOG_ERROR + "Error in connecting:%s" % e)
208 self.logger.warning("Webservice Failure, sleeping %s second before next attempt" % sleep_time)209 self.logger.warning("Webservice Failure, sleeping %s second before next attempt" % sleep_time)
209 time.sleep(sleep_time) 210 time.sleep(sleep_time)
210 raise osv.except_osv(_('User Error'), _('Error when try to connect to magento, are your sure that your login is right? Did openerp can access to your magento?'))211 raise except_osv(_('User Error'), _('Error when try to connect to magento, are your sure that your login is right? Did openerp can access to your magento?'))
211212
212 213
213 def call(self, method, *arguments): 214 def call(self, method, *arguments):
214 if arguments:215 if arguments:
215 arguments = list(arguments)[0]216 arguments = list(arguments)[0]
216 else:217 else:
@@ -242,7 +243,7 @@
242 except Exception, e:243 except Exception, e:
243 pass244 pass
244245
245class magerp_osv(osv.osv):246class MagerpModel(Model):
246 _register = False # Set to false if the model shouldn't be automatically discovered.247 _register = False # Set to false if the model shouldn't be automatically discovered.
247248
248 _MAGE_FIELD = 'magento_id'249 _MAGE_FIELD = 'magento_id'
@@ -254,7 +255,7 @@
254 _DELETE_METHOD = False255 _DELETE_METHOD = False
255 _mapping = {}256 _mapping = {}
256 DEBUG = False257 DEBUG = False
257 258
258 #TODO deprecated, remove use259 #TODO deprecated, remove use
259 def mage_to_oe(self, cr, uid, mageid, instance, *arguments):260 def mage_to_oe(self, cr, uid, mageid, instance, *arguments):
260 """given a record id in the Magento referential, returns a tuple (id, name) with the id in the OpenERP referential; Magento instance wise"""261 """given a record id in the Magento referential, returns a tuple (id, name) with the id in the OpenERP referential; Magento instance wise"""
@@ -279,7 +280,7 @@
279 read = self.read(cr, uid, oeid, [self._rec_name])280 read = self.read(cr, uid, oeid, [self._rec_name])
280 return (read[0]['id'], read[0][self._rec_name])281 return (read[0]['id'], read[0][self._rec_name])
281 return False282 return False
282 283
283 #TODO deprecated, remove use284 #TODO deprecated, remove use
284 def sync_import(self, cr, uid, magento_records, instance, debug=False, defaults=None, *attrs):285 def sync_import(self, cr, uid, magento_records, instance, debug=False, defaults=None, *attrs):
285286
@@ -314,7 +315,7 @@
314 'temp_vars':{},315 'temp_vars':{},
315 'mage2oe_filters':mage2oe_filters316 'mage2oe_filters':mage2oe_filters
316 }317 }
317 318
318 #now properly mapp known Magento attributes to OpenERP entity columns:319 #now properly mapp known Magento attributes to OpenERP entity columns:
319 for each_valid_key in self._mapping:320 for each_valid_key in self._mapping:
320 if each_valid_key in magento_record.keys():321 if each_valid_key in magento_record.keys():
@@ -353,7 +354,7 @@
353 self.record_save(cr, uid, rec_id, vals, defaults)354 self.record_save(cr, uid, rec_id, vals, defaults)
354 else:355 else:
355 self.record_save(cr, uid, rec_id, vals, defaults)356 self.record_save(cr, uid, rec_id, vals, defaults)
356 357
357 def record_save(self, cr, uid, rec_id, vals, defaults):358 def record_save(self, cr, uid, rec_id, vals, defaults):
358 if defaults:359 if defaults:
359 for key in defaults.keys():360 for key in defaults.keys():
@@ -364,7 +365,7 @@
364 else:365 else:
365 #Record is not there, create it366 #Record is not there, create it
366 self.create(cr, uid, vals,)367 self.create(cr, uid, vals,)
367 368
368 def cast_string(self, subject):369 def cast_string(self, subject):
369 """This function will convert string objects to the data type required. Example "0"/"1" to boolean conversion"""370 """This function will convert string objects to the data type required. Example "0"/"1" to boolean conversion"""
370 for key in subject.keys():371 for key in subject.keys():
@@ -374,7 +375,7 @@
374 else:375 else:
375 subject[key] = True376 subject[key] = True
376 return subject377 return subject
377 378
378 def mage_import_base(self,cr,uid,conn, external_referential_id, defaults=None, context=None):379 def mage_import_base(self,cr,uid,conn, external_referential_id, defaults=None, context=None):
379 if context is None:380 if context is None:
380 context = {}381 context = {}
@@ -396,7 +397,7 @@
396 list_method = self.pool.get('external.mapping').read(cr,uid,mapping_id[0],['external_list_method']).get('external_list_method',False)397 list_method = self.pool.get('external.mapping').read(cr,uid,mapping_id[0],['external_list_method']).get('external_list_method',False)
397 if list_method:398 if list_method:
398 data = conn.call(list_method, context['ids_or_filter'])399 data = conn.call(list_method, context['ids_or_filter'])
399 400
400 #it may happen that list method doesn't provide enough information, forcing us to use get_method on each record (case for sale orders)401 #it may happen that list method doesn't provide enough information, forcing us to use get_method on each record (case for sale orders)
401 if context.get('one_by_one', False):402 if context.get('one_by_one', False):
402 self.mage_import_one_by_one(cr, uid, conn, external_referential_id, mapping_id[0], data, defaults, context)403 self.mage_import_one_by_one(cr, uid, conn, external_referential_id, mapping_id[0], data, defaults, context)
@@ -437,8 +438,8 @@
437 else:438 else:
438 self.sync_import(cr, uid, magento_records, instance, debug, defaults)439 self.sync_import(cr, uid, magento_records, instance, debug, defaults)
439 else:440 else:
440 raise osv.except_osv(_('Undefined List method !'), _("list method is undefined for this object!"))441 raise except_osv(_('Undefined List method !'), _("list method is undefined for this object!"))
441 442
442 #TODO deprecated, remove use443 #TODO deprecated, remove use
443 def get_all_mage_ids(self, cr, uid, ids, instance=False):444 def get_all_mage_ids(self, cr, uid, ids, instance=False):
444 search_param = []445 search_param = []
@@ -451,4 +452,6 @@
451 for each in reads:452 for each in reads:
452 mageids.append(each[self._MAGE_FIELD])453 mageids.append(each[self._MAGE_FIELD])
453 return mageids454 return mageids
454 455
456# deprecated, bw compat
457magerp_osv = MagerpModel
455458
=== modified file 'magentoerpconnect/partner.py'
--- magentoerpconnect/partner.py 2012-06-01 18:21:53 +0000
+++ magentoerpconnect/partner.py 2012-12-03 15:22:20 +0000
@@ -22,47 +22,51 @@
22#along with this program. If not, see <http://www.gnu.org/licenses/>. #22#along with this program. If not, see <http://www.gnu.org/licenses/>. #
23#########################################################################23#########################################################################
2424
25from osv import osv, fields25import hashlib
26from tools.translate import _26
27import magerp_osv27from openerp.osv import fields
28from .magerp_osv import MagerpModel
28from base_external_referentials.decorator import only_for_referential29from base_external_referentials.decorator import only_for_referential
29import hashlib
3030
31class res_partner_category(magerp_osv.magerp_osv):31class res_partner_category(MagerpModel):
32 _inherit = "res.partner.category"32 _inherit = "res.partner.category"
3333 _columns = {'tax_class_id':fields.integer('Tax Class ID'),
34 _columns = {
35 'tax_class_id':fields.integer('Tax Class ID'),
36 }34 }
37res_partner_category()
3835
39class res_partner_address(magerp_osv.magerp_osv):36class res_partner_address(MagerpModel):
40 _inherit = "res.partner.address"37 _inherit = "res.partner.address"
4138
4239 #Migration script for 6.1.0 to 6.1.1
43 #TODO maybe move the fields company, firstname, lastname in an extra module40 def _auto_init(self, cr, context=None):
44 #On v7 the partner address model will totaly change so maybe it's not worth41 # recompute the field name with firstname + lastname
45 def _get_partner_name(self, cr, uid, ids, field_name, arg, context=None):42 # in order to have the same data as the data of base_partner_surname
46 res ={}43 first_install=False
47 for partner in self.browse(cr, uid, ids, context=context):44 cr.execute("SELECT column_name FROM information_schema.columns "
48 res[partner.id] = ((partner.company and partner.company + ' : ') or '') + \45 "WHERE table_name = 'res_partner_address' "
49 (partner.lastname and partner.lastname + ' ' or '') + \46 "AND column_name = 'firstname'")
50 (partner.firstname or '')47 if cr.fetchone():
51 return res48 cr.execute(
49 "UPDATE res_partner_address "
50 "SET name = CASE "
51 "WHEN firstname IS NOT NULL AND lastname IS NOT NULL THEN (firstname || ' ' || lastname) "
52 "WHEN firstname IS NOT NULL AND lastname IS NULL THEN firstname "
53 "WHEN firstname IS NULL AND lastname IS NOT NULL THEN lastname "
54 "ELSE name "
55 "END"
56 )
57 cr.execute("ALTER TABLE res_partner_address "
58 "RENAME COLUMN firstname TO first_name")
59 cr.execute("ALTER TABLE res_partner_address "
60 "RENAME COLUMN lastname TO last_name")
61 return super(res_partner_address, self)._auto_init(cr, context=context)
5262
53 _columns = {63 _columns = {
54 'name': fields.function(_get_partner_name, obj="res.partner.address", type = 'char', size = 256, string='Name',
55 store = {
56 'res.partner.address' : (lambda self, cr, uid, ids, c={}: ids,
57 ['company', 'firstname', 'lastname'], 10)}),
58 'company':fields.char('Company', size=100),64 'company':fields.char('Company', size=100),
59 'firstname':fields.char('First Name', size=100),
60 'lastname':fields.char('Last Name', size=100),
61 'is_magento_order_address':fields.boolean('Magento Order Address?'), #TODO still needed?65 'is_magento_order_address':fields.boolean('Magento Order Address?'), #TODO still needed?
62 }66 }
63 _defaults = {67 _defaults = {
64 'is_magento_order_address': lambda * a:False,68 'is_magento_order_address': lambda * a:False,
65 }69 }
6670
67 @only_for_referential('magento')71 @only_for_referential('magento')
68 def ext_create(self, cr, uid, external_session, resources, mapping, mapping_id, context=None):72 def ext_create(self, cr, uid, external_session, resources, mapping, mapping_id, context=None):
@@ -74,9 +78,7 @@
74 ext_create_ids[resource_id] = ext_id78 ext_create_ids[resource_id] = ext_id
75 return ext_create_ids79 return ext_create_ids
7680
77res_partner_address()81class res_partner(MagerpModel):
78
79class res_partner(magerp_osv.magerp_osv):
80 _inherit = "res.partner"82 _inherit = "res.partner"
8183
82 def _is_magento_exported(self, cr, uid, ids, field_name, arg, context=None):84 def _is_magento_exported(self, cr, uid, ids, field_name, arg, context=None):
@@ -94,20 +96,20 @@
94 return res96 return res
9597
96 _columns = {98 _columns = {
97 'group_id':fields.many2one('res.partner.category', 'Magento Group(Category)'),99 'group_id':fields.many2one('res.partner.category', 'Magento Group(Category)'),
98 'store_id':fields.many2one('magerp.storeviews', 'Last Store View', help="Last store view where the customer has bought."),100 'store_id':fields.many2one('magerp.storeviews', 'Last Store View', help="Last store view where the customer has bought."),
99 'store_ids':fields.many2many('magerp.storeviews', 'magerp_storeid_rel', 'partner_id', 'store_id', 'Store Views'),101 'store_ids':fields.many2many('magerp.storeviews', 'magerp_storeid_rel', 'partner_id', 'store_id', 'Store Views'),
100 'website_id':fields.many2one('external.shop.group', 'Magento Website', help='Select a website for which the Magento customer will be bound.'),102 'website_id':fields.many2one('external.shop.group', 'Magento Website', help='Select a website for which the Magento customer will be bound.'),
101 'created_in':fields.char('Created in', size=100),103 'created_in':fields.char('Created in', size=100),
102 'created_at':fields.datetime('Created Date'),104 'created_at':fields.datetime('Created Date'),
103 'updated_at':fields.datetime('Updated At'),105 'updated_at':fields.datetime('Updated At'),
104 'emailid':fields.char('Email Address', size=100, help="Magento uses this email ID to match the customer. If filled, if a Magento customer is imported from the selected website with the exact same email, he will be bound with this partner and this latter will be updated with Magento's values."),106 'emailid':fields.char('Email Address', size=100, help="Magento uses this email ID to match the customer. If filled, if a Magento customer is imported from the selected website with the exact same email, he will be bound with this partner and this latter will be updated with Magento's values."),
105 'mag_vat':fields.char('Magento VAT', size=50, help="To be able to receive customer VAT number you must set it in Magento Admin Panel, menu System / Configuration / Client Configuration / Name and Address Options."),107 'mag_vat':fields.char('Magento VAT', size=50, help="To be able to receive customer VAT number you must set it in Magento Admin Panel, menu System / Configuration / Client Configuration / Name and Address Options."),
106 'mag_birthday':fields.date('Birthday', help="To be able to receive customer birthday you must set it in Magento Admin Panel, menu System / Configuration / Client Configuration / Name and Address Options."),108 'mag_birthday':fields.date('Birthday', help="To be able to receive customer birthday you must set it in Magento Admin Panel, menu System / Configuration / Client Configuration / Name and Address Options."),
107 'mag_newsletter':fields.boolean('Newsletter'),109 'mag_newsletter':fields.boolean('Newsletter'),
108 'magento_exported': fields.function(_is_magento_exported, type="boolean", method=True, string="Exists on Magento"),110 'magento_exported': fields.function(_is_magento_exported, type="boolean", method=True, string="Exists on Magento"),
109 'magento_pwd': fields.char('Magento Password', size=256),111 'magento_pwd': fields.char('Magento Password', size=256),
110 }112 }
111113
112 _sql_constraints = [('emailid_uniq', 'unique(emailid, website_id)', 'A partner already exists with this email address on the selected website.')]114 _sql_constraints = [('emailid_uniq', 'unique(emailid, website_id)', 'A partner already exists with this email address on the selected website.')]
113115
@@ -124,7 +126,7 @@
124 AND ir_model_data.model = 'res.partner'126 AND ir_model_data.model = 'res.partner'
125 AND ir_model_data.referential_id = %(ref_id)s127 AND ir_model_data.referential_id = %(ref_id)s
126 WHERE ir_model_data.res_id IS NULL AND magerp_storeid_rel.store_id IN %(store_ids)s"""128 WHERE ir_model_data.res_id IS NULL AND magerp_storeid_rel.store_id IN %(store_ids)s"""
127 params = {'ref_id': external_session.referential_id.id, 129 params = {'ref_id': external_session.referential_id.id,
128 'store_ids': tuple(store_ids)}130 'store_ids': tuple(store_ids)}
129 cr.execute(query,params)131 cr.execute(query,params)
130 results = cr.dictfetchall()132 results = cr.dictfetchall()
@@ -134,7 +136,7 @@
134 @only_for_referential('magento')136 @only_for_referential('magento')
135 def _transform_and_send_one_resource(self, cr, uid, external_session, resource, resource_id,137 def _transform_and_send_one_resource(self, cr, uid, external_session, resource, resource_id,
136 update_date, mapping, mapping_id, defaults=None, context=None):138 update_date, mapping, mapping_id, defaults=None, context=None):
137 res = super(res_partner, self)._transform_and_send_one_resource(cr, uid, external_session, 139 res = super(res_partner, self)._transform_and_send_one_resource(cr, uid, external_session,
138 resource, resource_id, update_date, mapping, mapping_id, defaults=defaults, context=context)140 resource, resource_id, update_date, mapping, mapping_id, defaults=defaults, context=context)
139 if res:141 if res:
140 address_obj = self.pool.get('res.partner.address')142 address_obj = self.pool.get('res.partner.address')
@@ -142,5 +144,3 @@
142 for resource_id in resource_ids:144 for resource_id in resource_ids:
143 result = address_obj._export_one_resource(cr, uid, external_session, resource_id, context=context)145 result = address_obj._export_one_resource(cr, uid, external_session, resource_id, context=context)
144 return res146 return res
145
146res_partner()
147147
=== modified file 'magentoerpconnect/partner_view.xml'
--- magentoerpconnect/partner_view.xml 2012-05-19 13:37:23 +0000
+++ magentoerpconnect/partner_view.xml 2012-12-03 15:22:20 +0000
@@ -7,10 +7,8 @@
7 <field name="type">form</field>7 <field name="type">form</field>
8 <field name="inherit_id" ref="base.view_partner_form" />8 <field name="inherit_id" ref="base.view_partner_form" />
9 <field name="arch" type="xml">9 <field name="arch" type="xml">
10 <xpath expr="/form/notebook/page/field/form/group/field[@name='name']" position="replace" >10 <xpath expr="/form/notebook/page/field/form/group/field[@name='name']" position="after" >
11 <field name="company" />11 <field name="company" />
12 <field name="firstname" />
13 <field name="lastname" />
14 </xpath>12 </xpath>
15 <xpath expr="/form/notebook" position="inside">13 <xpath expr="/form/notebook" position="inside">
16 <page string="Magento Information">14 <page string="Magento Information">
@@ -50,10 +48,8 @@
50 <field name="type">form</field>48 <field name="type">form</field>
51 <field name="inherit_id" ref="base.view_partner_address_form1" />49 <field name="inherit_id" ref="base.view_partner_address_form1" />
52 <field name="arch" type="xml">50 <field name="arch" type="xml">
53 <field name="name" position="replace">51 <field name="name" position="after">
54 <field name="company" />52 <field name="company" />
55 <field name="firstname" />
56 <field name="lastname" />
57 </field>53 </field>
58 </field>54 </field>
59 </record>55 </record>
6056
=== modified file 'magentoerpconnect/product.py'
--- magentoerpconnect/product.py 2012-08-14 15:46:07 +0000
+++ magentoerpconnect/product.py 2012-12-03 15:22:20 +0000
@@ -22,26 +22,27 @@
22#along with this program. If not, see <http://www.gnu.org/licenses/>. #22#along with this program. If not, see <http://www.gnu.org/licenses/>. #
23#########################################################################23#########################################################################
2424
25from osv import osv, orm, fields
26import datetime
27import time25import time
28import pooler
29import magerp_osv
30from tools.translate import _
31import unicodedata26import unicodedata
32import base64, urllib27import base64, urllib
33import os28import os
29import xmlrpclib
34from lxml import etree30from lxml import etree
35import xmlrpclib
36
37import logging31import logging
32
33from openerp.osv.orm import Model, setup_modifiers
34from openerp.osv import fields
35from openerp.osv.osv import except_osv
36from openerp import pooler
37from openerp.tools.translate import _
38from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT
39
40from .magerp_osv import MagerpModel
41from base_external_referentials.decorator import only_for_referential, catch_error_in_report
42from base_external_referentials.external_osv import ExternalSession
43
38_logger = logging.getLogger(__name__)44_logger = logging.getLogger(__name__)
3945
40from tools import DEFAULT_SERVER_DATETIME_FORMAT
41
42from base_external_referentials.decorator import only_for_referential
43from base_external_referentials.external_osv import ExternalSession
44
45#Enabling this to True will put all custom attributes into One page in46#Enabling this to True will put all custom attributes into One page in
46#the products view47#the products view
47GROUP_CUSTOM_ATTRS_TOGETHER = False48GROUP_CUSTOM_ATTRS_TOGETHER = False
@@ -70,7 +71,7 @@
70 else:71 else:
71 return False72 return False
7273
73class magerp_product_category_attribute_options(magerp_osv.magerp_osv):74class magerp_product_category_attribute_options(MagerpModel):
74 _name = "magerp.product_category_attribute_options"75 _name = "magerp.product_category_attribute_options"
75 _description = "Option products category Attributes"76 _description = "Option products category Attributes"
76 _rec_name = "label"77 _rec_name = "label"
@@ -98,13 +99,10 @@
98 'value':fields.char('Value', size=200),99 'value':fields.char('Value', size=200),
99 #'ipcast':fields.char('Type cast', size=50),100 #'ipcast':fields.char('Type cast', size=50),
100 'label':fields.char('Label', size=100),101 'label':fields.char('Label', size=100),
101 }102 }
102103
103104
104magerp_product_category_attribute_options()105class product_category(MagerpModel):
105
106
107class product_category(magerp_osv.magerp_osv):
108 _inherit = "product.category"106 _inherit = "product.category"
109107
110 def _merge_with_default_values(self, cr, uid, external_session, ressource, vals, sub_mapping_list, defaults=None, context=None):108 def _merge_with_default_values(self, cr, uid, external_session, ressource, vals, sub_mapping_list, defaults=None, context=None):
@@ -152,16 +150,13 @@
152 parent_id = resource[main_lang]['parent_id']150 parent_id = resource[main_lang]['parent_id']
153 del resource[main_lang]['parent_id']151 del resource[main_lang]['parent_id']
154 external_session.connection.call('catalog_category.update', [ext_id, resource[main_lang], False])152 external_session.connection.call('catalog_category.update', [ext_id, resource[main_lang], False])
155 external_session.connection.call('catalog_category.move', [ext_id, parent_id])153 external_session.connection.call('oerp_catalog_category.move', [ext_id, parent_id])
156 for storeview, lang in storeview_to_lang.items():154 for storeview, lang in storeview_to_lang.items():
157 del resource[lang]['ext_id']155 del resource[lang]['ext_id']
158 external_session.connection.call('catalog_category.update', [ext_id, resource[lang], storeview])156 external_session.connection.call('catalog_category.update', [ext_id, resource[lang], storeview])
159 ext_update_ids[resource_id] = ext_id157 ext_update_ids[resource_id] = ext_id
160 return ext_update_ids158 return ext_update_ids
161159
162
163
164
165 _columns = {160 _columns = {
166 'magerp_fields' : fields.serialized('Magento Product Categories Extra Fields'),161 'magerp_fields' : fields.serialized('Magento Product Categories Extra Fields'),
167 'create_date': fields.datetime('Created date', readonly=True),162 'create_date': fields.datetime('Created date', readonly=True),
@@ -194,8 +189,6 @@
194 'page_layout': fields.many2one('magerp.product_category_attribute_options', 'Page Layout', domain="[('attribute_name', '=', 'page_layout')]"),189 'page_layout': fields.many2one('magerp.product_category_attribute_options', 'Page Layout', domain="[('attribute_name', '=', 'page_layout')]"),
195 }190 }
196191
197
198
199 _defaults = {192 _defaults = {
200 'display_mode':lambda * a:'PRODUCTS',193 'display_mode':lambda * a:'PRODUCTS',
201 'use_default_available_sort_by': lambda * a:True,194 'use_default_available_sort_by': lambda * a:True,
@@ -203,7 +196,7 @@
203 'level':lambda * a:1,196 'level':lambda * a:1,
204 'include_in_menu': lambda * a:True,197 'include_in_menu': lambda * a:True,
205 'page_layout': lambda self,cr,uid,c: self.pool.get('magerp.product_category_attribute_options')._get_default_option(cr, uid, 'page_layout', 'None', context=c),198 'page_layout': lambda self,cr,uid,c: self.pool.get('magerp.product_category_attribute_options')._get_default_option(cr, uid, 'page_layout', 'None', context=c),
206 }199 }
207200
208 def write(self, cr, uid, ids, vals, context=None):201 def write(self, cr, uid, ids, vals, context=None):
209 if not 'magerp_stamp' in vals.keys():202 if not 'magerp_stamp' in vals.keys():
@@ -224,10 +217,8 @@
224 ids = get_child_ids(categ_tree)217 ids = get_child_ids(categ_tree)
225 return ids218 return ids
226219
227product_category()220
228221class magerp_product_attributes(MagerpModel):
229
230class magerp_product_attributes(magerp_osv.magerp_osv):
231 _name = "magerp.product_attributes"222 _name = "magerp.product_attributes"
232 _description = "Attributes of products"223 _description = "Attributes of products"
233 _rec_name = "attribute_code"224 _rec_name = "attribute_code"
@@ -295,95 +286,84 @@
295 'based_on':fields.selection([('product_product', 'Product Product'), ('product_template', 'Product Template')], 'Based On'),286 'based_on':fields.selection([('product_product', 'Product Product'), ('product_template', 'Product Template')], 'Based On'),
296 }287 }
297288
298 _defaults = {289 _defaults = {'based_on': lambda*a: 'product_template',
299 'based_on': lambda*a: 'product_template',290 }
300 }
301
302 #mapping magentofield:(openerpfield,typecast,)291 #mapping magentofield:(openerpfield,typecast,)
303 #have an entry for each mapped field292 #have an entry for each mapped field
304 _no_create_list = [293 _no_create_list = ['product_id',
305 'product_id',294 'name',
306 'name',295 'description',
307 'description',296 'short_description',
308 'short_description',297 'sku',
309 'sku',298 'weight',
310 'weight',299 'category_ids',
311 'category_ids',300 'price',
312 'price',301 'cost',
313 'cost',302 'set',
314 'set',303 'ean',
315 'ean',304 ]
316 ]305 _translatable_default_codes = ['description',
317306 'meta_description',
318 _translatable_default_codes = [307 'meta_keyword',
319 'description',308 'meta_title',
320 'meta_description',309 'name',
321 'meta_keyword',310 'short_description',
322 'meta_title',311 'url_key',
323 'name',312 ]
324 'short_description',313 _not_store_in_json = ['minimal_price',
325 'url_key',314 'special_price',
326 ]315 'description',
327316 'meta_description',
328 _not_store_in_json = [317 'meta_keyword',
329 'minimal_price',318 'meta_title',
330 'special_price',319 'name',
331 'description',320 'short_description',
332 'meta_description',321 'url_key',
333 'meta_keyword',322 ]
334 'meta_title',323 _type_conversion = {'':'char',
335 'name',324 'text':'char',
336 'short_description',325 'textarea':'text',
337 'url_key',326 'select':'many2one',
338 ]327 'date':'date',
339328 'price':'float',
340 _type_conversion = {329 'media_image':'binary',
341 '':'char',330 'gallery':'binary',
342 'text':'char',331 'multiselect':'many2many',
343 'textarea':'text',332 'boolean':'boolean',
344 'select':'many2one',333 'weee':'char',
345 'date':'date',334 False:'char',
346 'price':'float',335 'file':'char', #this option is not a magento native field it will be better to found a generic solutionto manage this kind of custom option
347 'media_image':'binary',336 }
348 'gallery':'binary',337 _type_casts = {'':'unicode',
349 'multiselect':'many2many',338 'text':'unicode',
350 'boolean':'boolean',339 'textarea':'unicode',
351 'weee':'char',340 'select':'unicode',
352 False:'char',341 'date':'unicode',
353 'file':'char', #this option is not a magento native field it will be better to found a generic solutionto manage this kind of custom option342 'price':'float',
354 }343 'media_image':'False',
355344 'gallery':'False',
356 _type_casts = {345 'multiselect':'list',
357 '':'unicode',346 'boolean':'int',
358 'text':'unicode',347 'weee':'unicode',
359 'textarea':'unicode',348 False:'unicode',
360 'select':'unicode',349 'file':'unicode', #this option is not a magento native field it will be better to found a generic solutionto manage this kind of custom option
361 'date':'unicode',350 }
362 'price':'float',351 _variant_fields = ['color',
363 'media_image':'False',352 'dimension',
364 'gallery':'False',353 'visibility',
365 'multiselect':'list',354 'special_price',
366 'boolean':'int',355 'special_price_from_date',
367 'weee':'unicode',356 'special_price_to_date',
368 False:'unicode',357 ]
369 'file':'unicode', #this option is not a magento native field it will be better to found a generic solutionto manage this kind of custom option358
370 }359
371360 #For some field you can specify the syncronisation way
372 _variant_fields = [361 #in : Magento => OpenERP
373 'color',362 #out : Magento <= OpenERP
374 'dimension',363 #in_out (default_value) : Magento <=> OpenERP
375 'visibility',364 _sync_way = {'has_options' : 'in',
376 'special_price',365 'tier_price': 'in',
377 'special_price_from_date',366 }
378 'special_price_to_date',
379 ]
380
381
382 #TODO check if this field have to be in only one way and if yes add this feature
383 _sync_way = {
384 'has_options' : 'in',
385 'special_price' : 'in',
386 }
387367
388 def _is_attribute_translatable(self, vals):368 def _is_attribute_translatable(self, vals):
389 """Tells if field associated to attribute should be translatable or not.369 """Tells if field associated to attribute should be translatable or not.
@@ -493,7 +473,6 @@
493 # mapping have to be based on product.product473 # mapping have to be based on product.product
494 model_id = self.pool.get('ir.model').search(cr, uid, [('model', '=', 'product.product')])[0]474 model_id = self.pool.get('ir.model').search(cr, uid, [('model', '=', 'product.product')])[0]
495 self._create_mapping(cr, uid, field_vals['ttype'], field_id, field_name, referential_id, model_id, vals, crid)475 self._create_mapping(cr, uid, field_vals['ttype'], field_id, field_name, referential_id, model_id, vals, crid)
496
497 return crid476 return crid
498477
499 def _default_mapping(self, cr, uid, ttype, field_name, vals, attribute_id, model_id, mapping_line, referential_id):478 def _default_mapping(self, cr, uid, ttype, field_name, vals, attribute_id, model_id, mapping_line, referential_id):
@@ -557,17 +536,16 @@
557 mapping_line = {'external_field': vals['attribute_code'],536 mapping_line = {'external_field': vals['attribute_code'],
558 'sequence': 0,537 'sequence': 0,
559 'mapping_id': mapping_id[0],538 'mapping_id': mapping_id[0],
560 'type': 'in_out',539 'type': self._sync_way.get(vals['attribute_code'], 'in_out'),
561 'external_type': self._type_casts[vals.get('frontend_input', False)],540 'external_type': self._type_casts[vals.get('frontend_input', False)],
562 'field_id': field_id, }541 'field_id': field_id, }
563 mapping_line = self._default_mapping(cr, uid, ttype, field_name, vals, attribute_id, model_id, mapping_line, referential_id)542 mapping_line = self._default_mapping(cr, uid, ttype, field_name, vals, attribute_id, model_id, mapping_line, referential_id)
564 self.pool.get('external.mapping.line').create(cr, uid, mapping_line)543 self.pool.get('external.mapping.line').create(cr, uid, mapping_line)
565 return True544 return True
566545
567magerp_product_attributes()
568546
569"""Dont remove the code, we might need it --sharoon547"""Dont remove the code, we might need it --sharoon
570class magerp_product_attributes_set_info(osv.osv):548class magerp_product_attributes_set_info(Model):
571 _name="magerp.product_attributes.set_info"549 _name="magerp.product_attributes.set_info"
572 _description = "Attribute Set information for each attribute"550 _description = "Attribute Set information for each attribute"
573 _columns = {551 _columns = {
@@ -579,7 +557,7 @@
579 }557 }
580magerp_product_attributes_set_info()"""558magerp_product_attributes_set_info()"""
581559
582class magerp_product_attribute_options(magerp_osv.magerp_osv):560class magerp_product_attribute_options(MagerpModel):
583 _name = "magerp.product_attribute_options"561 _name = "magerp.product_attribute_options"
584 _description = "Options of selected attributes"562 _description = "Options of selected attributes"
585 _rec_name = "label"563 _rec_name = "label"
@@ -635,9 +613,8 @@
635 else:613 else:
636 return False614 return False
637615
638magerp_product_attribute_options()
639616
640class magerp_product_attribute_set(magerp_osv.magerp_osv):617class magerp_product_attribute_set(MagerpModel):
641 _name = "magerp.product_attribute_set"618 _name = "magerp.product_attribute_set"
642 _description = "Attribute sets in products"619 _description = "Attribute sets in products"
643 _rec_name = 'attribute_set_name'620 _rec_name = 'attribute_set_name'
@@ -649,8 +626,8 @@
649 'referential_id':fields.many2one('external.referential', 'Magento Instance', readonly=True),626 'referential_id':fields.many2one('external.referential', 'Magento Instance', readonly=True),
650 'magento_id':fields.integer('Magento ID'),627 'magento_id':fields.integer('Magento ID'),
651 }628 }
652 629
653 630
654 def update_attribute(self, cr, uid, ids, context=None):631 def update_attribute(self, cr, uid, ids, context=None):
655 ref_obj = self.pool.get('external.referential')632 ref_obj = self.pool.get('external.referential')
656 mag_ref_ids = ref_obj.search(cr, uid, [('version_id','ilike', 'magento')], context=context)633 mag_ref_ids = ref_obj.search(cr, uid, [('version_id','ilike', 'magento')], context=context)
@@ -735,9 +712,8 @@
735 cr.execute(query)712 cr.execute(query)
736 return True713 return True
737714
738magerp_product_attribute_set()
739715
740class magerp_product_attribute_groups(magerp_osv.magerp_osv):716class magerp_product_attribute_groups(MagerpModel):
741 _name = "magerp.product_attribute_groups"717 _name = "magerp.product_attribute_groups"
742 _description = "Attribute groups in Magento"718 _description = "Attribute groups in Magento"
743 _rec_name = 'attribute_group_name'719 _rec_name = 'attribute_group_name'
@@ -759,10 +735,9 @@
759 'sort_order':fields.integer('Sort Order'),735 'sort_order':fields.integer('Sort Order'),
760 'default_id':fields.integer('Default'),736 'default_id':fields.integer('Default'),
761 'referential_id':fields.many2one('external.referential', 'Magento Instance', readonly=True),737 'referential_id':fields.many2one('external.referential', 'Magento Instance', readonly=True),
762 }738 }
763magerp_product_attribute_groups()
764739
765class product_tierprice(osv.osv):740class product_tierprice(Model):
766 _name = "product.tierprice"741 _name = "product.tierprice"
767 _description = "Implements magento tier pricing"742 _description = "Implements magento tier pricing"
768743
@@ -782,7 +757,7 @@
782 'price_qty':fields.float('Quantity Slab', digits=(10, 4), help="Slab & above eg.For 10 and above enter 10"),757 'price_qty':fields.float('Quantity Slab', digits=(10, 4), help="Slab & above eg.For 10 and above enter 10"),
783 'product':fields.many2one('product.product', 'Product'),758 'product':fields.many2one('product.product', 'Product'),
784 'referential_id':fields.many2one('external.referential', 'Magento Instance', readonly=True),759 'referential_id':fields.many2one('external.referential', 'Magento Instance', readonly=True),
785 }760 }
786 _mapping = {761 _mapping = {
787 'cust_group':(False, int, """result=self.pool.get('res.partner.category').mage_to_oe(cr,uid,cust_group,instance)\nif result:\n\tresult=[('cust_group',result[0])]\nelse:\n\tresult=[('cust_group',False)]"""),762 'cust_group':(False, int, """result=self.pool.get('res.partner.category').mage_to_oe(cr,uid,cust_group,instance)\nif result:\n\tresult=[('cust_group',result[0])]\nelse:\n\tresult=[('cust_group',False)]"""),
788 'all_groups':(False, str, """if all_groups=='1':\n\tresult=[('group_scope','1')]\nelse:\n\tresult=[('group_scope','1')]"""),763 'all_groups':(False, str, """if all_groups=='1':\n\tresult=[('group_scope','1')]\nelse:\n\tresult=[('group_scope','1')]"""),
@@ -790,21 +765,18 @@
790 'price':('price', float),765 'price':('price', float),
791 'website_id':(False, int, """result=self.pool.get('external.shop.group').mage_to_oe(cr,uid,website_id,instance)\nif result:\n\tresult=[('website_id',result[0])]\nelse:\n\tresult=[('website_id',False)]"""),766 'website_id':(False, int, """result=self.pool.get('external.shop.group').mage_to_oe(cr,uid,website_id,instance)\nif result:\n\tresult=[('website_id',result[0])]\nelse:\n\tresult=[('website_id',False)]"""),
792 'price_qty':('price_qty', float),767 'price_qty':('price_qty', float),
793 }768 }
794product_tierprice()
795769
796class product_product_type(osv.osv):770class product_product_type(Model):
797 _name = 'magerp.product_product_type'771 _name = 'magerp.product_product_type'
798 _columns = {772 _columns = {
799 'name': fields.char('Name', size=100, required=True, translate=True),773 'name': fields.char('Name', size=100, required=True, translate=True),
800 'product_type': fields.char('Type', size=100, required=True, help="Use the same name of Magento product type, for example 'simple'."),774 'product_type': fields.char('Type', size=100, required=True, help="Use the same name of Magento product type, for example 'simple'."),
801 'default_type': fields.selection([('product','Stockable Product'),('consu', 'Consumable'),('service','Service')], 'Default Product Type', required=True, help="Default product's type (Procurement) when a product is imported from Magento."),775 'default_type': fields.selection([('product','Stockable Product'),('consu', 'Consumable'),('service','Service')], 'Default Product Type', required=True, help="Default product's type (Procurement) when a product is imported from Magento."),
802 }776 }
803product_product_type()777
804778
805779class product_mag_osv(MagerpModel):
806
807class product_mag_osv(magerp_osv.magerp_osv):
808 _register = False # Set to false if the model shouldn't be automatically discovered.780 _register = False # Set to false if the model shouldn't be automatically discovered.
809781
810 #remember one thing in life: Magento lies: it tells attributes are required while they are awkward to fill782 #remember one thing in life: Magento lies: it tells attributes are required while they are awkward to fill
@@ -819,7 +791,7 @@
819 set_id = self.read(cr, uid, ids, fields=['set'], context=context)[0]['set']791 set_id = self.read(cr, uid, ids, fields=['set'], context=context)[0]['set']
820792
821 if not set_id:793 if not set_id:
822 raise osv.except_osv(_('User Error'), _('Please chose an attribut set before'))794 raise except_osv(_('User Error'), _('Please chose an attribute set before'))
823795
824 return {796 return {
825 'name': 'Magento Fields',797 'name': 'Magento Fields',
@@ -948,17 +920,15 @@
948 f.set('nolabel', "1")920 f.set('nolabel', "1")
949 f.set('colspan', "4")921 f.set('colspan', "4")
950922
951 orm.setup_modifiers(923 setup_modifiers(f, fields_get[attribute['field_name']],
952 f, fields_get[attribute['field_name']],924 context=context)
953 context=context)
954925
955 if multiwebsites:926 if multiwebsites:
956 website_page = etree.SubElement(927 website_page = etree.SubElement(
957 notebook, 'page', string=_('Websites'))928 notebook, 'page', string=_('Websites'))
958 wf = etree.SubElement(929 wf = etree.SubElement(
959 website_page, 'field', name='websites_ids', nolabel="1")930 website_page, 'field', name='websites_ids', nolabel="1")
960 orm.setup_modifiers(931 setup_modifiers(wf, fields_get['websites_ids'], context=context)
961 wf, fields_get['websites_ids'], context=context)
962932
963 return notebook933 return notebook
964934
@@ -1025,14 +995,13 @@
1025 'page',995 'page',
1026 string=_('Magento Information'),996 string=_('Magento Information'),
1027 attrs=attrs_mag_notebook)997 attrs=attrs_mag_notebook)
1028 orm.setup_modifiers(magento_page, context=context)998 setup_modifiers(magento_page, context=context)
1029 f = etree.SubElement(999 f = etree.SubElement(
1030 magento_page,1000 magento_page,
1031 'field',1001 'field',
1032 name='product_type',1002 name='product_type',
1033 attrs="{'required': [('magento_exportable', '=', True)]}")1003 attrs="{'required': [('magento_exportable', '=', True)]}")
1034 orm.setup_modifiers(1004 setup_modifiers(f, field=result['fields']['product_type'], context=context)
1035 f, field=result['fields']['product_type'], context=context)
1036 magento_page.append(attributes_notebook)1005 magento_page.append(attributes_notebook)
1037 btn.getparent().remove(btn)1006 btn.getparent().remove(btn)
1038 else:1007 else:
@@ -1050,18 +1019,21 @@
1050 type='object',1019 type='object',
1051 colspan='2',1020 colspan='2',
1052 attrs=attrs_mag_notebook)1021 attrs=attrs_mag_notebook)
1053 orm.setup_modifiers(new_btn, context=context)1022 setup_modifiers(new_btn, context=context)
1054 btn.getparent().replace(btn, new_btn)1023 btn.getparent().replace(btn, new_btn)
1055 if page_placeholder:1024 if page_placeholder:
1056 placeholder = page_placeholder[0]1025 placeholder = page_placeholder[0]
1057 placeholder.getparent().remove(placeholder)1026 placeholder.getparent().remove(placeholder)
10581027
1059 result['arch'] = etree.tostring(eview, pretty_print=True)1028 result['arch'] = etree.tostring(eview, pretty_print=True)
1029 #TODO understand (and fix) why the orm fill the field size for the text field :S
1030 for field in result['fields']:
1031 if result['fields'][field]['type'] == 'text':
1032 if 'size' in result['fields'][field]: del result['fields'][field]['size']
1060 return result1033 return result
10611034
1062class product_template(product_mag_osv):1035class product_template(product_mag_osv):
1063 _inherit = "product.template"1036 _inherit = "product.template"
1064
1065 _columns = {1037 _columns = {
1066 'magerp_tmpl' : fields.serialized('Magento Template Fields'),1038 'magerp_tmpl' : fields.serialized('Magento Template Fields'),
1067 'set':fields.many2one('magerp.product_attribute_set', 'Attribute Set'),1039 'set':fields.many2one('magerp.product_attribute_set', 'Attribute Set'),
@@ -1071,19 +1043,15 @@
1071 ('no', 'Do Not Manage Stock'),1043 ('no', 'Do Not Manage Stock'),
1072 ('yes','Manage Stock')],1044 ('yes','Manage Stock')],
1073 'Manage Stock Level'),1045 'Manage Stock Level'),
1074 }1046 }
1075
1076 _defaults = {1047 _defaults = {
1077 'mag_manage_stock': 'use_default',1048 'mag_manage_stock': 'use_default',
1078 }1049 }
1079
1080product_template()
10811050
10821051
1083class product_product(product_mag_osv):1052class product_product(product_mag_osv):
1084 _inherit = "product.product"1053 _inherit = "product.product"
10851054
1086
1087 def send_to_external(self, cr, uid, external_session, resources, mapping, mapping_id, update_date=None, context=None):1055 def send_to_external(self, cr, uid, external_session, resources, mapping, mapping_id, update_date=None, context=None):
1088 product_ids = resources.keys()1056 product_ids = resources.keys()
1089 res = super(product_product, self).send_to_external(cr, uid, external_session, resources, mapping, mapping_id, update_date=update_date, context=context)1057 res = super(product_product, self).send_to_external(cr, uid, external_session, resources, mapping, mapping_id, update_date=update_date, context=context)
@@ -1096,7 +1064,7 @@
1096 ext_id = res['product_id']1064 ext_id = res['product_id']
1097 external_session.connection.call('ol_catalog_product.update', [ext_id, resource, False, 'id'])1065 external_session.connection.call('ol_catalog_product.update', [ext_id, resource, False, 'id'])
1098 return ext_id1066 return ext_id
1099 1067
1100 @only_for_referential('magento')1068 @only_for_referential('magento')
1101 def _get_external_resources(self, cr, uid, external_session, external_id=None, resource_filter=None,1069 def _get_external_resources(self, cr, uid, external_session, external_id=None, resource_filter=None,
1102 mapping=None, mapping_id=None, fields=None, context=None):1070 mapping=None, mapping_id=None, fields=None, context=None):
@@ -1110,8 +1078,8 @@
1110 mapping_id=mapping_id,1078 mapping_id=mapping_id,
1111 fields=fields,1079 fields=fields,
1112 context=context)1080 context=context)
1113 1081
1114 1082
1115 #TODO reimplement the grouped product1083 #TODO reimplement the grouped product
1116 def ext_create(self, cr, uid, external_session, resources, mapping=None, mapping_id=None, context=None):1084 def ext_create(self, cr, uid, external_session, resources, mapping=None, mapping_id=None, context=None):
1117 ext_create_ids={}1085 ext_create_ids={}
@@ -1134,7 +1102,7 @@
1134 try:1102 try:
1135 ext_id = self.map_and_update_product(cr, uid, external_session, resource[main_lang], sku, context=context)1103 ext_id = self.map_and_update_product(cr, uid, external_session, resource[main_lang], sku, context=context)
1136 except:1104 except:
1137 raise osv.except_osv(_('Error!'), _("Product %s already exist in Magento. Failed to rebind it. Please do it manually")%(sku))1105 raise except_osv(_('Error!'), _("Product %s already exist in Magento. Failed to rebind it. Please do it manually")%(sku))
1138 else:1106 else:
1139 raise1107 raise
11401108
@@ -1256,10 +1224,10 @@
1256 set_to_product_ids[product.set.id] = [product.id]1224 set_to_product_ids[product.set.id] = [product.id]
1257 else:1225 else:
1258 set_to_product_ids[product.set.id].append(product.id)1226 set_to_product_ids[product.set.id].append(product.id)
1259 for attribut_id in set_to_product_ids:1227 for attribut_id, product_ids in set_to_product_ids.iteritems():
1260 context['attribut_set_id'] = attribut_id1228 context['attribut_set_id'] = attribut_id
1261 resources.update(super(product_product, self)._get_oe_resources(1229 resources.update(super(product_product, self)._get_oe_resources(
1262 cr, uid, external_session, ids, langs,1230 cr, uid, external_session, product_ids, langs,
1263 smart_export=smart_export,1231 smart_export=smart_export,
1264 last_exported_date=last_exported_date,1232 last_exported_date=last_exported_date,
1265 mapping=mapping,1233 mapping=mapping,
@@ -1391,9 +1359,17 @@
1391 break1359 break
1392 if not_delete:1360 if not_delete:
1393 if len(ids) > 1:1361 if len(ids) > 1:
1394 raise osv.except_osv(_('Warning!'), _('They are some products related to Magento. They can not be deleted!\nYou can change their Magento status to "Disabled" and uncheck the active box to hide them from OpenERP.'))1362 raise except_osv(_('Warning!'),
1363 _('They are some products related to Magento. '
1364 'They can not be deleted!\n'
1365 'You can change their Magento status to "Disabled" '
1366 'and uncheck the active box to hide them from OpenERP.'))
1395 else:1367 else:
1396 raise osv.except_osv(_('Warning!'), _('This product is related to Magento. It can not be deleted!\nYou can change it Magento status to "Disabled" and uncheck the active box to hide it from OpenERP.'))1368 raise except_osv(_('Warning!'),
1369 _('This product is related to Magento. '
1370 'It can not be deleted!\n'
1371 'You can change it Magento status to "Disabled" '
1372 'and uncheck the active box to hide it from OpenERP.'))
1397 else:1373 else:
1398 return super(product_product, self).unlink(cr, uid, ids, context)1374 return super(product_product, self).unlink(cr, uid, ids, context)
13991375
@@ -1433,29 +1409,20 @@
1433 #This can be base on the group_fields that can try tle last write date of a group of fields1409 #This can be base on the group_fields that can try tle last write date of a group of fields
1434 if context is None: context = {}1410 if context is None: context = {}
14351411
1436 shop = external_session.sync_from_object
1437
1438 # exclude service products
1439 stock_product_ids = self.search(
1440 cr, uid,
1441 [('id', 'in', ids),
1442 ('type', '!=', 'service'),
1443 ('magento_exportable', '=', True)],
1444 context=context)
1445
1446 # use the stock location defined on the sale shop1412 # use the stock location defined on the sale shop
1447 # to compute the stock value1413 # to compute the stock value
1448 stock = shop.warehouse_id.lot_stock_id1414 stock = external_session.sync_from_object.warehouse_id.lot_stock_id
1449 location_ctx = context.copy()1415 location_ctx = context.copy()
1450 location_ctx['location'] = stock.id1416 location_ctx['location'] = stock.id
1451 products = self.browse(1417 for product_id in ids:
1452 cr, uid, stock_product_ids, context=location_ctx)1418 self._export_inventory(cr, uid, external_session, product_id, context=location_ctx)
14531419
1454 for product in products:
1455 self._export_inventory(cr, uid, external_session, product, stock, context=location_ctx)
1456 return True1420 return True
14571421
1458 def _export_inventory(self, cr, uid, external_session, product, stock, context=None):1422 @catch_error_in_report
1423 def _export_inventory(self, cr, uid, external_session, product_id, context=None):
1424 product = self.browse(cr, uid, product_id, context=context)
1425 stock = external_session.sync_from_object.warehouse_id.lot_stock_id
1459 mag_product_id = self.get_extid(1426 mag_product_id = self.get_extid(
1460 cr, uid, product.id, external_session.referential_id.id, context=context)1427 cr, uid, product.id, external_session.referential_id.id, context=context)
1461 if not mag_product_id:1428 if not mag_product_id:
@@ -1463,7 +1430,7 @@
1463 inventory_vals = self._prepare_inventory_magento_vals(1430 inventory_vals = self._prepare_inventory_magento_vals(
1464 cr, uid, product, stock, external_session.sync_from_object, context=context)1431 cr, uid, product, stock, external_session.sync_from_object, context=context)
14651432
1466 external_session.connection.call('product_stock.update',1433 external_session.connection.call('oerp_cataloginventory_stock_item.update',
1467 [mag_product_id, inventory_vals])1434 [mag_product_id, inventory_vals])
14681435
1469 external_session.logger.info(1436 external_session.logger.info(
@@ -1617,5 +1584,3 @@
1617 finally:1584 finally:
1618 local_cr.close()1585 local_cr.close()
1619 return True1586 return True
1620
1621product_product()
16221587
=== modified file 'magentoerpconnect/product_images.py'
--- magentoerpconnect/product_images.py 2012-06-22 10:15:40 +0000
+++ magentoerpconnect/product_images.py 2012-12-03 15:22:20 +0000
@@ -20,22 +20,30 @@
20#You should have received a copy of the GNU General Public License #20#You should have received a copy of the GNU General Public License #
21#along with this program. If not, see <http://www.gnu.org/licenses/>. #21#along with this program. If not, see <http://www.gnu.org/licenses/>. #
22#########################################################################22#########################################################################
23from osv import osv, fields
24import magerp_osv
25import mimetypes23import mimetypes
26import netsvc24
27from tools.translate import _25from openerp.osv.orm import Model
28import base6426from openerp.osv import fields
27from openerp.tools.translate import _
28
29from .magerp_osv import MagerpModel
29from base_external_referentials.decorator import commit_now30from base_external_referentials.decorator import commit_now
30from base_external_referentials.decorator import only_for_referential31from base_external_referentials.decorator import only_for_referential
3132
32#TODO the option small_image, thumbnail, exclude, base_image, should be store diferently indeed this is not compatible with mutli instance (maybe serialized will be a good solution)33#TODO Option on image should be compatible with multi-referential
33#Moreover when a small is selected the flag on other image should be remove as magento does34#Indeed when you have two Magento maybe you do not want to use the
3435#same image for the base_image, thumbnail ot small_image
35#TODO refactor all of this code and use the generic function from base_external_referentials.36#Maybe the solution will to use a serialized field that store the
36#To must useless line of code37#value for each referential
3738
38class product_images(magerp_osv.magerp_osv):39#TODO As only one image can be a small_image, thumbnail or base_image
40#We should add some constraint or automatically remove the flag on the
41#other image of the product.
42
43#TODO refactor all of this code and use the generic function from
44#base_external_referentials.
45
46class product_images(MagerpModel):
39 _inherit = "product.images"47 _inherit = "product.images"
40 _columns = {48 _columns = {
41 'base_image':fields.boolean('Base Image'),49 'base_image':fields.boolean('Base Image'),
@@ -46,20 +54,20 @@
46 'sync_status':fields.boolean('Sync Status', readonly=True),54 'sync_status':fields.boolean('Sync Status', readonly=True),
47 'create_date': fields.datetime('Created date', readonly=True),55 'create_date': fields.datetime('Created date', readonly=True),
48 'write_date': fields.datetime('Updated date', readonly=True),56 'write_date': fields.datetime('Updated date', readonly=True),
49 }57 }
50 _defaults = {58 _defaults = {
51 'sync_status':lambda * a: False,59 'sync_status':lambda * a: False,
52 'base_image':lambda * a:True,60 'base_image':lambda * a:True,
53 'small_image':lambda * a:True,61 'small_image':lambda * a:True,
54 'thumbnail':lambda * a:True,62 'thumbnail':lambda * a:True,
55 'exclude':lambda * a:False63 'exclude':lambda * a:False
56 }64 }
57 65
58 def get_changed_ids(self, cr, uid, start_date=False):66 def get_changed_ids(self, cr, uid, start_date=False):
59 proxy = self.pool.get('product.images')67 proxy = self.pool.get('product.images')
60 domain = start_date and ['|', ('create_date', '>', start_date), ('write_date', '>', start_date)] or []68 domain = start_date and ['|', ('create_date', '>', start_date), ('write_date', '>', start_date)] or []
61 return proxy.search(cr, uid, domain)69 return proxy.search(cr, uid, domain)
62 70
63 def del_image_name(self, cr, uid, id, context=None):71 def del_image_name(self, cr, uid, id, context=None):
64 if context is None: context = {}72 if context is None: context = {}
65 image_ext_name_obj = self.pool.get('product.images.external.name')73 image_ext_name_obj = self.pool.get('product.images.external.name')
@@ -129,7 +137,7 @@
129 image_2_date[image['id']] = image['write_date'] or image['create_date']137 image_2_date[image['id']] = image['write_date'] or image['create_date']
130 list_date = date_2_image.keys()138 list_date = date_2_image.keys()
131 list_date.sort()139 list_date.sort()
132 140
133 ids = [date_2_image[date] for date in list_date]141 ids = [date_2_image[date] for date in list_date]
134142
135 while ids:143 while ids:
@@ -185,5 +193,3 @@
185 ids = ids[1000:]193 ids = ids[1000:]
186 external_session.logger.info("still %s image to export" %len(ids))194 external_session.logger.info("still %s image to export" %len(ids))
187 return True195 return True
188
189product_images()
190196
=== modified file 'magentoerpconnect/product_images_view.xml'
--- magentoerpconnect/product_images_view.xml 2011-11-27 15:12:39 +0000
+++ magentoerpconnect/product_images_view.xml 2012-12-03 15:22:20 +0000
@@ -1,24 +1,24 @@
1<?xml version="1.0" encoding="UTF-8"?>1<?xml version="1.0" encoding="UTF-8"?>
2<openerp>2<openerp>
3 <data>3 <data>
4 <record id="view_product_image_form" model="ir.ui.view">4 <record id="view_product_image_form" model="ir.ui.view">
5 <field name="name">product.images.form.inherit</field>5 <field name="name">product.images.form.inherit</field>
6 <field name="model">product.images</field>6 <field name="model">product.images</field>
7 <field name="inherit_id" ref="product_images_olbs.view_product_image_form" />7 <field name="inherit_id" ref="product_images_olbs.view_product_image_form" />
8 <field name="type">form</field>8 <field name="type">form</field>
9 <field name="arch" type="xml">9 <field name="arch" type="xml">
10 <xpath expr="/form/notebook/page/field[@name='file']"10 <xpath expr="/form/notebook/page/field[@name='file']"
11 position="after">11 position="after">
12 <group col="4" colspan="2">12 <group col="4" colspan="2">
13 <field name="base_image" colspan="4" />13 <field name="base_image" colspan="4" />
14 <field name="small_image" colspan="4" />14 <field name="small_image" colspan="4" />
15 </group>15 </group>
16 <group col="4" colspan="2">16 <group col="4" colspan="2">
17 <field name="thumbnail" colspan="4" />17 <field name="thumbnail" colspan="4" />
18 <field name="exclude" colspan="4" />18 <field name="exclude" colspan="4" />
19 </group>19 </group>
20 </xpath>20 </xpath>
21 </field>21 </field>
22 </record>22 </record>
23 </data>23 </data>
24</openerp>24</openerp>
2525
=== modified file 'magentoerpconnect/product_links.py'
--- magentoerpconnect/product_links.py 2011-06-07 14:33:14 +0000
+++ magentoerpconnect/product_links.py 2012-12-03 15:22:20 +0000
@@ -18,14 +18,10 @@
18#18#
19##############################################################################19##############################################################################
2020
21from osv import fields, osv21from openerp.osv.orm import Model
2222from openerp.osv import fields
2323
24class product_link(osv.osv):24class product_link(Model):
25 _inherit = 'product.link'25 _inherit = 'product.link'
2626 _columns = {'sequence': fields.integer('Position'),
27 _columns = {27 }
28 'sequence': fields.integer('Position'),
29 }
30
31product_link()
3228
=== modified file 'magentoerpconnect/product_view.xml'
--- magentoerpconnect/product_view.xml 2012-06-21 16:33:03 +0000
+++ magentoerpconnect/product_view.xml 2012-12-03 15:22:20 +0000
@@ -1,270 +1,270 @@
1<?xml version="1.0" encoding="utf-8"?>1<?xml version="1.0" encoding="utf-8"?>
2<openerp>2<openerp>
3 <data>3 <data>
4 <!--Magento Product Category Tree/Form view -->4 <!--Magento Product Category Tree/Form view -->
55
6 <record model="ir.ui.view" id="product_category_form_view_magerp2">6 <record model="ir.ui.view" id="product_category_form_view_magerp2">
7 <field name="name">product.category.form_view_magerp2</field>7 <field name="name">product.category.form_view_magerp2</field>
8 <field name="model">product.category</field>8 <field name="model">product.category</field>
9 <field name="inherit_id" ref="product.product_category_form_view" />9 <field name="inherit_id" ref="product.product_category_form_view" />
10 <field name="type">form</field>10 <field name="type">form</field>
11 <field name="arch" type="xml">11 <field name="arch" type="xml">
12 <xpath expr="/form/field[@name='sequence']" position="after">12 <xpath expr="/form/field[@name='sequence']" position="after">
13 <group colspan="4" col="4" attrs="{'invisible':[('magento_exportable','!=',1)],'readonly':[('level','=',0)]}">13 <group colspan="4" col="4" attrs="{'invisible':[('magento_exportable','!=',1)],'readonly':[('level','=',0)]}">
14 <separator string="Magento Information" colspan="4" />14 <separator string="Magento Information" colspan="4" />
15 <notebook attrs="{'invisible':[('magento_exportable','!=',1)]}" colspan="4">15 <notebook attrs="{'invisible':[('magento_exportable','!=',1)]}" colspan="4">
16 <page string="General Information">16 <page string="General Information">
17 <group cols="2" colspan="4">17 <group cols="2" colspan="4">
18 <group col="2" colspan="1">18 <group col="2" colspan="1">
19 <separator string="Meta Information" colspan="2" />19 <separator string="Meta Information" colspan="2" />
20 <field name="meta_title" colspan="2" />20 <field name="meta_title" colspan="2" />
21 <field name="meta_keywords" colspan="2" />21 <field name="meta_keywords" colspan="2" />
22 <field name="meta_description" colspan="2" />22 <field name="meta_description" colspan="2" />
23 <field name="url_key" colspan="2" />23 <field name="url_key" colspan="2" />
24 <field name="level" colspan="2" />24 <field name="level" colspan="2" />
25 <field name="include_in_menu" colspan="2" />25 <field name="include_in_menu" colspan="2" />
26 </group>26 </group>
27 <group col="1" colspan="1">27 <group col="1" colspan="1">
28 <separator string="Category Image" />28 <separator string="Category Image" />
29 <field name="image" nolabel="1" widget="image" />29 <field name="image" nolabel="1" widget="image" />
30 <field name="image_name" colspan="1" nolabel="1" />30 <field name="image_name" colspan="1" nolabel="1" />
31 <separator string="Description" />31 <separator string="Description" />
32 <field name="description" colspan="1" nolabel="1" />32 <field name="description" colspan="1" nolabel="1" />
33 <group col="4" colspan="1">33 <group col="4" colspan="1">
34 <field name="is_active" colspan="1" />34 <field name="is_active" colspan="1" />
35 <field name="magento_parent_id" />35 <field name="magento_parent_id" />
36 </group>36 </group>
37 </group>37 </group>
38 </group>38 </group>
3939
40 </page>40 </page>
41 <page string="Display Settings">41 <page string="Display Settings">
42 <group col="4" colspan="4">42 <group col="4" colspan="4">
43 <separator string="Display Mode" colspan="4" />43 <separator string="Display Mode" colspan="4" />
44 <field name="display_mode" colspan="1" nolabel="1" />44 <field name="display_mode" colspan="1" nolabel="1" />
45 <label string="Products only means that the products associated to the category will display, but not any static blocks.Static block only means that the selected static block will display, but none of the products.Static block and products means that the static block will display with the products listed directly beneath it." colspan="3" />45 <label string="Products only means that the products associated to the category will display, but not any static blocks.Static block only means that the selected static block will display, but none of the products.Static block and products means that the static block will display with the products listed directly beneath it." colspan="3" />
46 </group>46 </group>
47 <separator string="Use Anchor" colspan="4" />47 <separator string="Use Anchor" colspan="4" />
48 <group col="4" colspan="4">48 <group col="4" colspan="4">
49 <field name="is_anchor" colspan="1" />49 <field name="is_anchor" colspan="1" />
50 <label string="Anchored categories will display all products associated to all child categories (and child of child, and child of child of child,etc.) on that category's page, along with the products associated directly to the parent category." colspan="3" />50 <label string="Anchored categories will display all products associated to all child categories (and child of child, and child of child of child,etc.) on that category's page, along with the products associated directly to the parent category." colspan="3" />
51 </group>51 </group>
52 <group col="4" colspan="4">52 <group col="4" colspan="4">
53 <group col="10" colspan="2">53 <group col="10" colspan="2">
54 <separator string="Available Sorting method" colspan="10" />54 <separator string="Available Sorting method" colspan="10" />
55 <field name="use_default_available_sort_by" string="Use Default Config"/>55 <field name="use_default_available_sort_by" string="Use Default Config"/>
56 <field name="available_sort_by" colspan="10" nolabel="1" attrs="{'readonly':[('use_default_available_sort_by','=',True)],'required':[('use_default_available_sort_by','=',False)]}">56 <field name="available_sort_by" colspan="10" nolabel="1" attrs="{'readonly':[('use_default_available_sort_by','=',True)],'required':[('use_default_available_sort_by','=',False)]}">
57 <tree string="Available Sort By">57 <tree string="Available Sort By">
58 <field name="label"/>58 <field name="label"/>
59 </tree>59 </tree>
60 </field>60 </field>
61 </group>61 </group>
62 <group col="2" colspan="2">62 <group col="2" colspan="2">
63 <separator string="Default Sorting method" colspan="2" />63 <separator string="Default Sorting method" colspan="2" />
64 <field name="default_sort_by" widget="selection" nolabel="1" domain="[('attribute_name', '=', 'sort_by')]"/>64 <field name="default_sort_by" widget="selection" nolabel="1" domain="[('attribute_name', '=', 'sort_by')]"/>
65 <separator string="Page Layout" colspan="2" />65 <separator string="Page Layout" colspan="2" />
66 <field name="page_layout" nolabel="1" widget="selection" domain="[('attribute_name', '=', 'page_layout')]"/>66 <field name="page_layout" nolabel="1" widget="selection" domain="[('attribute_name', '=', 'page_layout')]"/>
67 </group>67 </group>
68 </group>68 </group>
69 </page>69 </page>
70 </notebook>70 </notebook>
71 </group>71 </group>
72 </xpath>72 </xpath>
73 </field>73 </field>
74 </record>74 </record>
7575
76 <record model="ir.ui.view" id="product_category_form_view_magerp">76 <record model="ir.ui.view" id="product_category_form_view_magerp">
77 <field name="name">product.category.form_view_magerp</field>77 <field name="name">product.category.form_view_magerp</field>
78 <field name="model">product.category</field>78 <field name="model">product.category</field>
79 <field name="inherit_id" ref="product.product_category_form_view" />79 <field name="inherit_id" ref="product.product_category_form_view" />
80 <field name="type">form</field>80 <field name="type">form</field>
81 <field name="arch" type="xml">81 <field name="arch" type="xml">
82 <field name="sequence" position="after">82 <field name="sequence" position="after">
83 <field name="magento_exportable" />83 <field name="magento_exportable" />
84 </field>84 </field>
85 </field>85 </field>
86 </record>86 </record>
8787
88 <!--Magento product_attribute_set Tree/Form view -->88 <!--Magento product_attribute_set Tree/Form view -->
89 <record model="ir.ui.view" id="magerp_product_attribute_set_form">89 <record model="ir.ui.view" id="magerp_product_attribute_set_form">
90 <field name="name">magerp.product_attribute_set.form</field>90 <field name="name">magerp.product_attribute_set.form</field>
91 <field name="model">magerp.product_attribute_set</field>91 <field name="model">magerp.product_attribute_set</field>
92 <field name="type">form</field>92 <field name="type">form</field>
93 <field name="arch" type="xml">93 <field name="arch" type="xml">
94 <form string="Magento Product Attribute Sets">94 <form string="Magento Product Attribute Sets">
95 <group col="4" colspan="4">95 <group col="4" colspan="4">
96 <field name="sort_order" readonly="1" />96 <field name="sort_order" readonly="1" />
97 <field name="attribute_set_name" readonly="1" />97 <field name="attribute_set_name" readonly="1" />
98 <button name="update_attribute" string="Update Attributes" colspan="2" type="object" />98 <button name="update_attribute" string="Update Attributes" colspan="2" type="object" />
99 </group>99 </group>
100 <separator string="Attributes in Set" colspan="4" />100 <separator string="Attributes in Set" colspan="4" />
101 <field name="attributes" nolabel="1" readonly="1" />101 <field name="attributes" nolabel="1" readonly="1" />
102 </form>102 </form>
103 </field>103 </field>
104 </record>104 </record>
105 <record model="ir.ui.view" id="magerp_product_attribute_set_tree">105 <record model="ir.ui.view" id="magerp_product_attribute_set_tree">
106 <field name="name">magerp.product_attribute_set.tree</field>106 <field name="name">magerp.product_attribute_set.tree</field>
107 <field name="model">magerp.product_attribute_set</field>107 <field name="model">magerp.product_attribute_set</field>
108 <field name="type">tree</field>108 <field name="type">tree</field>
109 <field name="arch" type="xml">109 <field name="arch" type="xml">
110 <tree string="Magento Product Attribute Set">110 <tree string="Magento Product Attribute Set">
111 <field name="sort_order" select="2" />111 <field name="sort_order" select="2" />
112 <field name="attribute_set_name" select="1" />112 <field name="attribute_set_name" select="1" />
113 </tree>113 </tree>
114 </field>114 </field>
115 </record>115 </record>
116 <record id="act_magerp_product_attribute_set_form" model="ir.actions.act_window">116 <record id="act_magerp_product_attribute_set_form" model="ir.actions.act_window">
117 <field name="name">Magento Product Attribute Sets</field>117 <field name="name">Magento Product Attribute Sets</field>
118 <field name="res_model">magerp.product_attribute_set</field>118 <field name="res_model">magerp.product_attribute_set</field>
119 <field name="src_model">magerp.product_attribute_set</field>119 <field name="src_model">magerp.product_attribute_set</field>
120 <field name="type">ir.actions.act_window</field>120 <field name="type">ir.actions.act_window</field>
121 <field name="view_type">form</field>121 <field name="view_type">form</field>
122 <field name="view_mode">tree,form</field>122 <field name="view_mode">tree,form</field>
123 <field name="view_id" ref="magerp_product_attribute_set_tree" />123 <field name="view_id" ref="magerp_product_attribute_set_tree" />
124 </record>124 </record>
125125
126 <!--Magento product_attributes Tree/Form view -->126 <!--Magento product_attributes Tree/Form view -->
127 <record model="ir.ui.view" id="magerp_product_attributes_form">127 <record model="ir.ui.view" id="magerp_product_attributes_form">
128 <field name="name">magerp.product_attributes.form</field>128 <field name="name">magerp.product_attributes.form</field>
129 <field name="model">magerp.product_attributes</field>129 <field name="model">magerp.product_attributes</field>
130 <field name="type">form</field>130 <field name="type">form</field>
131 <field name="arch" type="xml">131 <field name="arch" type="xml">
132 <form string="Magento Product Attributes">132 <form string="Magento Product Attributes">
133 <group col="4" colspan="4">133 <group col="4" colspan="4">
134 <field name="attribute_code" />134 <field name="attribute_code" />
135 <field name="frontend_input" select="2" />135 <field name="frontend_input" select="2" />
136 <field name="frontend_class" />136 <field name="frontend_class" />
137 <field name="backend_model" />137 <field name="backend_model" />
138 <field name="backend_type" select="2" />138 <field name="backend_type" select="2" />
139 <field name="frontend_label"/>139 <field name="frontend_label"/>
140140
141 <field name="is_visible_in_advanced_search" select="2" />141 <field name="is_visible_in_advanced_search" select="2" />
142 <field name="is_global" />142 <field name="is_global" />
143 <field name="is_filterable" />143 <field name="is_filterable" />
144 <field name="is_comparable" />144 <field name="is_comparable" />
145 <field name="is_visible" />145 <field name="is_visible" />
146 <field name="is_searchable" />146 <field name="is_searchable" />
147 <field name="is_user_defined" />147 <field name="is_user_defined" />
148 <field name="is_configurable" />148 <field name="is_configurable" />
149149
150 <field name="is_visible_on_front" />150 <field name="is_visible_on_front" />
151 <field name="is_used_for_price_rules" />151 <field name="is_used_for_price_rules" />
152 <field name="is_unique" />152 <field name="is_unique" />
153 <field name="is_required" />153 <field name="is_required" />
154 <field name="position" />154 <field name="position" />
155155
156 <field name="group" />156 <field name="group" />
157 <field name="apply_to" select="2" />157 <field name="apply_to" select="2" />
158 <field name="default_value" />158 <field name="default_value" />
159 <field name="note" />159 <field name="note" />
160 <field name="entity_type_id" />160 <field name="entity_type_id" />
161 <field name="options" readonly="1" />161 <field name="options" readonly="1" />
162 <field name="field_name" />162 <field name="field_name" />
163 <field name="based_on" />163 <field name="based_on" />
164 </group>164 </group>
165 </form>165 </form>
166 </field>166 </field>
167 </record>167 </record>
168 <record model="ir.ui.view" id="magerp_product_attributes_tree">168 <record model="ir.ui.view" id="magerp_product_attributes_tree">
169 <field name="name">magerp.product_attributes.tree</field>169 <field name="name">magerp.product_attributes.tree</field>
170 <field name="model">magerp.product_attributes</field>170 <field name="model">magerp.product_attributes</field>
171 <field name="type">tree</field>171 <field name="type">tree</field>
172 <field name="arch" type="xml">172 <field name="arch" type="xml">
173 <tree string="Magento Product Attributes">173 <tree string="Magento Product Attributes">
174 <field name="attribute_code" select="1" />174 <field name="attribute_code" select="1" />
175 <field name="frontend_label" select="1"/>175 <field name="frontend_label" select="1"/>
176 <field name="is_visible" select="1"/>176 <field name="is_visible" select="1"/>
177 <field name="is_required" select="1"/>177 <field name="is_required" select="1"/>
178 <field name="is_searchable" select="1" />178 <field name="is_searchable" select="1" />
179 <field name="is_comparable" select="1" />179 <field name="is_comparable" select="1" />
180 <field name="entity_type_id" select="1" />180 <field name="entity_type_id" select="1" />
181 <field name="group" select="1" />181 <field name="group" select="1" />
182 </tree>182 </tree>
183 </field>183 </field>
184 </record>184 </record>
185 <record id="act_magerp_product_attributes_form" model="ir.actions.act_window">185 <record id="act_magerp_product_attributes_form" model="ir.actions.act_window">
186 <field name="name">Magento Product Attributes</field>186 <field name="name">Magento Product Attributes</field>
187 <field name="res_model">magerp.product_attributes</field>187 <field name="res_model">magerp.product_attributes</field>
188 <field name="src_model">magerp.product_attributes</field>188 <field name="src_model">magerp.product_attributes</field>
189 <field name="type">ir.actions.act_window</field>189 <field name="type">ir.actions.act_window</field>
190 <field name="view_type">form</field>190 <field name="view_type">form</field>
191 <field name="view_mode">tree,form</field>191 <field name="view_mode">tree,form</field>
192 <field name="view_id" ref="magerp_product_attributes_tree" />192 <field name="view_id" ref="magerp_product_attributes_tree" />
193 </record>193 </record>
194194
195 <!--Magento product_attribute groups Tree/Form view -->195 <!--Magento product_attribute groups Tree/Form view -->
196 <record model="ir.ui.view" id="magerp_product_attribute_groups_form">196 <record model="ir.ui.view" id="magerp_product_attribute_groups_form">
197 <field name="name">magerp.product_attribute_groups.form</field>197 <field name="name">magerp.product_attribute_groups.form</field>
198 <field name="model">magerp.product_attribute_groups</field>198 <field name="model">magerp.product_attribute_groups</field>
199 <field name="type">form</field>199 <field name="type">form</field>
200 <field name="arch" type="xml">200 <field name="arch" type="xml">
201 <form string="Magento Product Attributes Groups">201 <form string="Magento Product Attributes Groups">
202 <group col="4" colspan="4">202 <group col="4" colspan="4">
203 <field name="attribute_group_name" />203 <field name="attribute_group_name" />
204 <field name="attribute_set" />204 <field name="attribute_set" />
205 <field name="default_id" />205 <field name="default_id" />
206 <field name="sort_order" />206 <field name="sort_order" />
207 </group>207 </group>
208 </form>208 </form>
209 </field>209 </field>
210 </record>210 </record>
211 <record model="ir.ui.view" id="magerp_product_attribute_groups_tree">211 <record model="ir.ui.view" id="magerp_product_attribute_groups_tree">
212 <field name="name">magerp.product_attribute_groups.tree</field>212 <field name="name">magerp.product_attribute_groups.tree</field>
213 <field name="model">magerp.product_attribute_groups</field>213 <field name="model">magerp.product_attribute_groups</field>
214 <field name="type">tree</field>214 <field name="type">tree</field>
215 <field name="arch" type="xml">215 <field name="arch" type="xml">
216 <tree string="Magento Product Attribute groups">216 <tree string="Magento Product Attribute groups">
217 <field name="attribute_group_name" select="1" />217 <field name="attribute_group_name" select="1" />
218 <field name="attribute_set" select="2" />218 <field name="attribute_set" select="2" />
219 <field name="default_id" select="2" />219 <field name="default_id" select="2" />
220 <field name="sort_order" select="2" />220 <field name="sort_order" select="2" />
221 </tree>221 </tree>
222 </field>222 </field>
223 </record>223 </record>
224 <record id="act_magerp_product_attribute_groups_form" model="ir.actions.act_window">224 <record id="act_magerp_product_attribute_groups_form" model="ir.actions.act_window">
225 <field name="name">Magento Product Attribute Groups</field>225 <field name="name">Magento Product Attribute Groups</field>
226 <field name="res_model">magerp.product_attribute_groups</field>226 <field name="res_model">magerp.product_attribute_groups</field>
227 <field name="src_model">magerp.product_attribute_groups</field>227 <field name="src_model">magerp.product_attribute_groups</field>
228 <field name="type">ir.actions.act_window</field>228 <field name="type">ir.actions.act_window</field>
229 <field name="view_type">form</field>229 <field name="view_type">form</field>
230 <field name="view_mode">tree,form</field>230 <field name="view_mode">tree,form</field>
231 <field name="view_id" ref="magerp_product_attribute_groups_tree" />231 <field name="view_id" ref="magerp_product_attribute_groups_tree" />
232 </record>232 </record>
233233
234 <!-- This is a product inherited form that will be dynamically populated-->234 <!-- This is a product inherited form that will be dynamically populated-->
235 <record model="ir.ui.view" id="product_product_form_view_magerp">235 <record model="ir.ui.view" id="product_product_form_view_magerp">
236 <field name="name">product.normal.form_magerp</field>236 <field name="name">product.normal.form_magerp</field>
237 <field name="model">product.product</field>237 <field name="model">product.product</field>
238 <field name="inherit_id" ref="product.product_normal_form_view" />238 <field name="inherit_id" ref="product.product_normal_form_view" />
239 <field name="type">form</field>239 <field name="type">form</field>
240 <field name="arch" type="xml">240 <field name="arch" type="xml">
241 <data>241 <data>
242 <xpath expr="/form/group/group/field[@name='ean13']" position="after">242 <xpath expr="/form/group/group/field[@name='ean13']" position="after">
243 <field name="magento_exported" invisible="True"/>243 <field name="magento_exported" invisible="True"/>
244 </xpath>244 </xpath>
245 <xpath expr="/form/group/group/field[@name='variants']" position="after">245 <xpath expr="/form/group/group/field[@name='variants']" position="after">
246 <field name="set" select="2" attrs="{'required':[('magento_exportable','==',True)], 'readonly': [('magento_exported', '=', True)]}"/>246 <field name="set" select="2" attrs="{'required':[('magento_exportable','==',True)], 'readonly': [('magento_exported', '=', True)]}"/>
247 </xpath>247 </xpath>
248 <xpath expr="/form/group/group/field[@name='sale_ok']" position="before">248 <xpath expr="/form/group/group/field[@name='sale_ok']" position="before">
249 <button name="open_magento_fields"/>249 <button name="open_magento_fields"/>
250 </xpath>250 </xpath>
251 <xpath expr="/form/notebook" position="before">251 <xpath expr="/form/notebook" position="before">
252 <field name="magento_exportable" select="2"/>252 <field name="magento_exportable" select="2"/>
253 </xpath>253 </xpath>
254 </data>254 </data>
255 </field>255 </field>
256 </record>256 </record>
257 <record model="ir.ui.view" id="product_product_form_view_magerpdynamic">257 <record model="ir.ui.view" id="product_product_form_view_magerpdynamic">
258 <field name="name">product.normal.form_magerp_dynamic</field>258 <field name="name">product.normal.form_magerp_dynamic</field>
259 <field name="model">product.product</field>259 <field name="model">product.product</field>
260 <field name="inherit_id" ref="product.product_normal_form_view" />260 <field name="inherit_id" ref="product.product_normal_form_view" />
261 <field name="type">form</field>261 <field name="type">form</field>
262 <field name="arch" type="xml">262 <field name="arch" type="xml">
263 <xpath expr="/form/notebook" position="inside">263 <xpath expr="/form/notebook" position="inside">
264 <page string="attributes_placeholder"/>264 <page string="attributes_placeholder"/>
265 </xpath>265 </xpath>
266 </field>266 </field>
267 </record>267 </record>
268268
269 <!--Magento Product Product Wizard Form view-->269 <!--Magento Product Product Wizard Form view-->
270270
@@ -293,34 +293,34 @@
293 </field>293 </field>
294 </record>294 </record>
295295
296 <!--Magento Product Type Tree/Form view -->296 <!--Magento Product Type Tree/Form view -->
297 <record model="ir.ui.view" id="magerp_product_type_form">297 <record model="ir.ui.view" id="magerp_product_type_form">
298 <field name="name">magerp.product_product_type.form</field>298 <field name="name">magerp.product_product_type.form</field>
299 <field name="model">magerp.product_product_type</field>299 <field name="model">magerp.product_product_type</field>
300 <field name="type">form</field>300 <field name="type">form</field>
301 <field name="priority" eval="5"/>301 <field name="priority" eval="5"/>
302 <field name="arch" type="xml">302 <field name="arch" type="xml">
303 <form string="Product Type">303 <form string="Product Type">
304 <field name="product_type"/>304 <field name="product_type"/>
305 <field name="name"/>305 <field name="name"/>
306 <field name="default_type"/>306 <field name="default_type"/>
307 </form>307 </form>
308 </field>308 </field>
309 </record>309 </record>
310 310
311 <record model="ir.ui.view" id="magerp_product_type_tree">311 <record model="ir.ui.view" id="magerp_product_type_tree">
312 <field name="name">magerp.product_product_type.tree</field>312 <field name="name">magerp.product_product_type.tree</field>
313 <field name="model">magerp.product_product_type</field>313 <field name="model">magerp.product_product_type</field>
314 <field name="type">tree</field>314 <field name="type">tree</field>
315 <field name="priority" eval="5"/>315 <field name="priority" eval="5"/>
316 <field name="arch" type="xml">316 <field name="arch" type="xml">
317 <tree string="Product Type" editable="top">317 <tree string="Product Type" editable="top">
318 <field name="name" select="1"/>318 <field name="name" select="1"/>
319 <field name="product_type" select="1"/>319 <field name="product_type" select="1"/>
320 <field name="default_type" select="1"/>320 <field name="default_type" select="1"/>
321 </tree>321 </tree>
322 </field>322 </field>
323 </record>323 </record>
324324
325 <record model="ir.actions.act_window" id="act_magerp_product_type_form">325 <record model="ir.actions.act_window" id="act_magerp_product_type_form">
326 <field name="name">Product Types</field>326 <field name="name">Product Types</field>
@@ -331,43 +331,43 @@
331331
332332
333 <!--Magento product_category attribute_option Tree/Form view -->333 <!--Magento product_category attribute_option Tree/Form view -->
334 <record model="ir.ui.view" id="magerp_product_category_attribute_options_form">334 <record model="ir.ui.view" id="magerp_product_category_attribute_options_form">
335 <field name="name">magerp.product_category_attribute_options.form</field>335 <field name="name">magerp.product_category_attribute_options.form</field>
336 <field name="model">magerp.product_category_attribute_options</field>336 <field name="model">magerp.product_category_attribute_options</field>
337 <field name="type">form</field>337 <field name="type">form</field>
338 <field name="arch" type="xml">338 <field name="arch" type="xml">
339 <form string="Magento Product Category Attribute Option">339 <form string="Magento Product Category Attribute Option">
340 <group col="4" colspan="4">340 <group col="4" colspan="4">
341 <field name="attribute_name" />341 <field name="attribute_name" />
342 <field name="label" />342 <field name="label" />
343 <field name="value" />343 <field name="value" />
344 </group>344 </group>
345 </form>345 </form>
346 </field>346 </field>
347 </record>347 </record>
348348
349 <record model="ir.ui.view" id="magerp_product_category_attribute_options_tree">349 <record model="ir.ui.view" id="magerp_product_category_attribute_options_tree">
350 <field name="name">magerp.product_category_attribute_options.tree</field>350 <field name="name">magerp.product_category_attribute_options.tree</field>
351 <field name="model">magerp.product_category_attribute_options</field>351 <field name="model">magerp.product_category_attribute_options</field>
352 <field name="type">tree</field>352 <field name="type">tree</field>
353 <field name="arch" type="xml">353 <field name="arch" type="xml">
354 <tree string="Magento Product Category Attribute Option">354 <tree string="Magento Product Category Attribute Option">
355 <field name="attribute_name" />355 <field name="attribute_name" />
356 <field name="label" />356 <field name="label" />
357 <field name="value" />357 <field name="value" />
358 </tree>358 </tree>
359 </field>359 </field>
360 </record>360 </record>
361361
362 <record id="act_magerp_product_category_attribute_options_form" model="ir.actions.act_window">362 <record id="act_magerp_product_category_attribute_options_form" model="ir.actions.act_window">
363 <field name="name">Magento Product Category Attribute Options</field>363 <field name="name">Magento Product Category Attribute Options</field>
364 <field name="res_model">magerp.product_category_attribute_options</field>364 <field name="res_model">magerp.product_category_attribute_options</field>
365 <field name="src_model">magerp.product_category_attribute_options</field>365 <field name="src_model">magerp.product_category_attribute_options</field>
366 <field name="type">ir.actions.act_window</field>366 <field name="type">ir.actions.act_window</field>
367 <field name="view_type">form</field>367 <field name="view_type">form</field>
368 <field name="view_mode">tree,form</field>368 <field name="view_mode">tree,form</field>
369 <field name="view_id" ref="magerp_product_category_attribute_options_tree" />369 <field name="view_id" ref="magerp_product_category_attribute_options_tree" />
370 </record>370 </record>
371371
372 <!--Magento attribute_option Search/Tree/Form view -->372 <!--Magento attribute_option Search/Tree/Form view -->
373373
@@ -433,5 +433,5 @@
433 <field name="search_view_id" ref="magerp_product_attribute_options_search"/>433 <field name="search_view_id" ref="magerp_product_attribute_options_search"/>
434 </record>434 </record>
435435
436 </data>436 </data>
437</openerp>437</openerp>
438438
=== modified file 'magentoerpconnect/sale.py'
--- magentoerpconnect/sale.py 2012-08-20 09:39:45 +0000
+++ magentoerpconnect/sale.py 2012-12-03 15:22:20 +0000
@@ -22,17 +22,16 @@
22#along with this program. If not, see <http://www.gnu.org/licenses/>. #22#along with this program. If not, see <http://www.gnu.org/licenses/>. #
23#########################################################################23#########################################################################
2424
25from osv import osv, fields25from openerp.osv.orm import Model
26import pooler26from openerp.osv import fields
27import magerp_osv27from openerp.osv.osv import except_osv
28import netsvc28import netsvc
29from tools.translate import _29from tools.translate import _
30import string30from openerp import tools
31import tools
32import time31import time
33from tools import DEFAULT_SERVER_DATETIME_FORMAT32from tools import DEFAULT_SERVER_DATETIME_FORMAT
34from base_external_referentials.external_osv import ExternalSession33from base_external_referentials.external_osv import ExternalSession
35from base_external_referentials.decorator import only_for_referential34from base_external_referentials.decorator import only_for_referential, open_report
3635
37#from base_external_referentials import report36#from base_external_referentials import report
3837
@@ -54,7 +53,7 @@
54 'waiting_date': 'holded'}53 'waiting_date': 'holded'}
55SALE_ORDER_IMPORT_STEP = 20054SALE_ORDER_IMPORT_STEP = 200
5655
57class sale_shop(osv.osv):56class sale_shop(Model):
58 _inherit = "sale.shop"57 _inherit = "sale.shop"
5958
60 @only_for_referential('magento')59 @only_for_referential('magento')
@@ -71,14 +70,16 @@
71 context['lang_to_export'].append(storeview.lang_id.code)70 context['lang_to_export'].append(storeview.lang_id.code)
72 return context71 return context
7372
74
75
76 def _get_exportable_product_ids(self, cr, uid, ids, name, args, context=None):73 def _get_exportable_product_ids(self, cr, uid, ids, name, args, context=None):
77 res = super(sale_shop, self)._get_exportable_product_ids(cr, uid, ids, name, args, context=None)74 res = super(sale_shop, self)._get_exportable_product_ids(cr, uid, ids, name, args, context=None)
78 for shop_id in res:75 for shop_id in res:
79 website_id = self.read(cr, uid, shop_id, ['shop_group_id'])76 website_id = self.read(cr, uid, shop_id, ['shop_group_id'])
80 if website_id.get('shop_group_id', False):77 if website_id.get('shop_group_id', False):
81 res[shop_id] = self.pool.get('product.product').search(cr, uid, [('magento_exportable', '=', True), ('id', 'in', res[shop_id]), "|", ('websites_ids', 'in', [website_id['shop_group_id'][0]]) , ('websites_ids', '=', False)])78 res[shop_id] = self.pool.get('product.product').search(cr, uid,
79 [('magento_exportable', '=', True),
80 ('id', 'in', res[shop_id]),
81 "|", ('websites_ids', 'in', [website_id['shop_group_id'][0]]),
82 ('websites_ids', '=', False)])
82 else:83 else:
83 res[shop_id] = []84 res[shop_id] = []
84 return res85 return res
@@ -138,7 +139,10 @@
138 if model_data_id:139 if model_data_id:
139 ir_model_data_obj.write(cr, uid, model_data_id, {'res_id' : value}, context=context)140 ir_model_data_obj.write(cr, uid, model_data_id, {'res_id' : value}, context=context)
140 else:141 else:
141 raise osv.except_osv(_('Warning!'), _('No external id found, are you sure that the referential are syncronized? Please contact your administrator. (more information in magentoerpconnect/sale.py)'))142 raise except_osv(_('Warning!'),
143 _('No external id found, are you sure that the referential are syncronized? '
144 'Please contact your administrator. '
145 '(more information in magentoerpconnect/sale.py)'))
142 return True146 return True
143147
144 def _get_exportable_root_category_ids(self, cr, uid, ids, prop, unknow_none, context=None):148 def _get_exportable_root_category_ids(self, cr, uid, ids, prop, unknow_none, context=None):
@@ -155,6 +159,11 @@
155 defaults.update({'magento_shop' : True})159 defaults.update({'magento_shop' : True})
156 return defaults160 return defaults
157161
162 @only_for_referential('magento')
163 @open_report
164 def _export_inventory(self, *args, **kwargs):
165 return super(sale_shop, self)._export_inventory(*args, **kwargs)
166
158 _columns = {167 _columns = {
159 'default_storeview_integer_id':fields.integer('Magento default Storeview ID'), #This field can't be a many2one because store field will be mapped before creating storeviews168 'default_storeview_integer_id':fields.integer('Magento default Storeview ID'), #This field can't be a many2one because store field will be mapped before creating storeviews
160 'default_storeview_id':fields.function(_get_default_storeview_id, type="many2one", relation="magerp.storeviews", method=True, string="Default Storeview"),169 'default_storeview_id':fields.function(_get_default_storeview_id, type="many2one", relation="magerp.storeviews", method=True, string="Default Storeview"),
@@ -234,12 +243,9 @@
234 def run_import_check_need_to_update(self, cr, uid, context=None):243 def run_import_check_need_to_update(self, cr, uid, context=None):
235 self._sale_shop(cr, uid, self.check_need_to_update, context=context)244 self._sale_shop(cr, uid, self.check_need_to_update, context=context)
236245
237sale_shop()246
238247class sale_order(Model):
239
240class sale_order(osv.osv):
241 _inherit = "sale.order"248 _inherit = "sale.order"
242
243 _columns = {249 _columns = {
244 'magento_incrementid': fields.char('Magento Increment ID', size=32),250 'magento_incrementid': fields.char('Magento Increment ID', size=32),
245 'magento_storeview_id': fields.many2one('magerp.storeviews', 'Magento Store View'),251 'magento_storeview_id': fields.many2one('magerp.storeviews', 'Magento Store View'),
@@ -247,7 +253,7 @@
247 'shop_id', 'referential_id', 'magento_referential',253 'shop_id', 'referential_id', 'magento_referential',
248 type='boolean',254 type='boolean',
249 string='Is a Magento Sale Order')255 string='Is a Magento Sale Order')
250 }256 }
251257
252 def _auto_init(self, cr, context=None):258 def _auto_init(self, cr, context=None):
253 tools.drop_view_if_exists(cr, 'sale_report')259 tools.drop_view_if_exists(cr, 'sale_report')
@@ -323,7 +329,7 @@
323 wf_service.trg_validate(uid, 'sale.order', canceled_order_id, 'cancel', cr)329 wf_service.trg_validate(uid, 'sale.order', canceled_order_id, 'cancel', cr)
324 self.log(cr, uid, canceled_order_id, "order %s canceled when updated from external system" % (canceled_order_id,))330 self.log(cr, uid, canceled_order_id, "order %s canceled when updated from external system" % (canceled_order_id,))
325 _logger.info("Order %s canceled when updated from external system because it has been replaced by a new one", canceled_order_id)331 _logger.info("Order %s canceled when updated from external system because it has been replaced by a new one", canceled_order_id)
326 except osv.except_osv, e:332 except except_osv, e:
327 #TODO: generic reporting of errors in magentoerpconnect333 #TODO: generic reporting of errors in magentoerpconnect
328 # except if the sale order has been confirmed for example, we cannot cancel the order334 # except if the sale order has been confirmed for example, we cannot cancel the order
329 to_cancel_order_name = self.read(cr, uid, canceled_order_id, ['name'])['name']335 to_cancel_order_name = self.read(cr, uid, canceled_order_id, ['name'])['name']
@@ -384,7 +390,7 @@
384 resource['lastname'] = resource['customer_lastname']390 resource['lastname'] = resource['customer_lastname']
385 resource['email'] = resource['customer_email']391 resource['email'] = resource['customer_email']
386392
387 shop = self.pool.get('sale.shop').browse(cr, uid, defaults['shop_id'], context=context)393 shop = external_session.sync_from_object
388 partner_defaults = {'website_id': shop.shop_group_id.id}394 partner_defaults = {'website_id': shop.shop_group_id.id}
389 res = self.pool.get('res.partner')._record_one_external_resource(cr, uid, external_session, resource,\395 res = self.pool.get('res.partner')._record_one_external_resource(cr, uid, external_session, resource,\
390 mapping=mapping, defaults=partner_defaults, context=context)396 mapping=mapping, defaults=partner_defaults, context=context)
@@ -401,14 +407,17 @@
401 mapping_line_filter_ids=None, parent_data=None, previous_result=None, defaults=None, context=None):407 mapping_line_filter_ids=None, parent_data=None, previous_result=None, defaults=None, context=None):
402 resource = self.clean_magento_resource(cr, uid, resource, context=context)408 resource = self.clean_magento_resource(cr, uid, resource, context=context)
403 resource = self.clean_magento_items(cr, uid, resource, context=context)409 resource = self.clean_magento_items(cr, uid, resource, context=context)
404 if not resource['customer_id']:410 for line in mapping[mapping_id]['mapping_lines']:
405 #If there is not partner it's a guest order411 if line['name'] == 'customer_id' and not resource.get('customer_id'):
406 #So we remove the useless information412 #If there is not partner it's a guest order
407 #And create a partner on fly and set the data in the default value413 #So we remove the useless information
408 del resource['customer_id']414 #And create a partner on fly and set the data in the default value
409 del resource['billing_address']['customer_id']415 #We only do this if the customer_id is in the mapping line
410 del resource['shipping_address']['customer_id']416 #Indeed when we check if a sale order exist only the name is asked for convertion
411 defaults = self.create_onfly_partner(cr, uid, external_session, resource, mapping, defaults, context=context)417 resource.pop('customer_id', None)
418 resource['billing_address'].pop('customer_id', None)
419 resource['shipping_address'].pop('customer_id', None)
420 defaults = self.create_onfly_partner(cr, uid, external_session, resource, mapping, defaults, context=context)
412421
413 return super(sale_order, self)._transform_one_resource(cr, uid, external_session, convertion_type, resource,\422 return super(sale_order, self)._transform_one_resource(cr, uid, external_session, convertion_type, resource,\
414 mapping, mapping_id, mapping_line_filter_ids=mapping_line_filter_ids, parent_data=parent_data,\423 mapping, mapping_id, mapping_line_filter_ids=mapping_line_filter_ids, parent_data=parent_data,\
@@ -624,7 +633,7 @@
624 # in the sale order and sometime it's equal to NONE in the address but at least the633 # in the sale order and sometime it's equal to NONE in the address but at least the
625 # the information is correct in one of this field634 # the information is correct in one of this field
626 # So I make this ugly code to try to fix it.635 # So I make this ugly code to try to fix it.
627 if not resource['customer_id']:636 if not resource.get('customer_id'):
628 if resource['billing_address'].get('customer_id'):637 if resource['billing_address'].get('customer_id'):
629 resource['customer_id'] = resource['billing_address']['customer_id']638 resource['customer_id'] = resource['billing_address']['customer_id']
630 else:639 else:
@@ -634,13 +643,9 @@
634 resource['shipping_address']['customer_id'] = resource['customer_id']643 resource['shipping_address']['customer_id'] = resource['customer_id']
635 return resource644 return resource
636645
637sale_order()646
638647class sale_order_line(Model):
639
640class sale_order_line(osv.osv):
641
642 _inherit = 'sale.order.line'648 _inherit = 'sale.order.line'
643
644 _columns = {649 _columns = {
645 # Rised the precision of the sale.order.line discount field650 # Rised the precision of the sale.order.line discount field
646 # from 2 to 3 digits in order to be able to have the same amount as Magento.651 # from 2 to 3 digits in order to be able to have the same amount as Magento.
@@ -649,7 +654,5 @@
649 # With a 2 digits precision, we can have 50.17 % => 148.99 or 50.16% => 149.02.654 # With a 2 digits precision, we can have 50.17 % => 148.99 or 50.16% => 149.02.
650 # Rise the digits to 3 allows to have 50.167% => 149€655 # Rise the digits to 3 allows to have 50.167% => 149€
651 'discount': fields.float('Discount (%)', digits=(16, 3), readonly=True, states={'draft': [('readonly', False)]}),656 'discount': fields.float('Discount (%)', digits=(16, 3), readonly=True, states={'draft': [('readonly', False)]}),
652 }657 }
653
654sale_order_line()
655658
656659
=== modified file 'magentoerpconnect/sale_view.xml'
--- magentoerpconnect/sale_view.xml 2012-08-14 09:18:30 +0000
+++ magentoerpconnect/sale_view.xml 2012-12-03 15:22:20 +0000
@@ -1,45 +1,75 @@
1<?xml version="1.0" encoding="utf-8"?>1<?xml version="1.0" encoding="utf-8"?>
2<openerp>2<openerp>
3 <data>3 <data>
44
5 <record model="ir.ui.view" id="magerp_view_shop_form">5
6 <field name="name">magerp_view_shop_form</field>6 <record model="ir.ui.view" id="magerp_view_shop_form">
7 <field name="model">sale.shop</field>7 <field name="name">magerp_view_shop_form</field>
8 <field name="inherit_id"8 <field name="model">sale.shop</field>
9 ref="base_sale_multichannels.base_sale_multichannels_view_shop_form" />9 <field name="inherit_id"
10 <field name="type">form</field>10 ref="base_sale_multichannels.base_sale_multichannels_view_shop_form" />
11 <field name="arch" type="xml">11 <field name="type">form</field>
12 <data>12 <field name="arch" type="xml">
13 <field name="referential_id" position="replace">13 <field name="referential_id" position="replace">
14 <field name="referential_id" attrs="{'readonly': [('magento_shop','=',True)]}"/> 14 <field name="referential_id" attrs="{'readonly': [('type_name', '=', 'Magento')]}"/>
15 </field>15 </field>
16 <field name="shop_group_id" position="replace">16 <page string="External Shop Settings" position="before">
17 <field name="shop_group_id" readonly="True"/>17 <page string="Magento Actions" attrs="{'invisible': [('type_name', '!=', 'Magento')]}">
18 <field name="magento_root_category"/>18 <group col="6" colspan="4">
19 <field name="storeview_ids" nolabel="1" colspan="4"/>19 <group col="3" colspan="3">
20 <separator string="Magento Option" colspan="4"/>20 <separator string="Catalog" colspan="3"/>
21 <field name="magento_shop" />21 <group col="1" colspan="1">
22 <field name="allow_magento_order_status_push" />22 <button name="export_catalog" string="Export Catalog" colspan="1" type="object"/>
23 <field name="allow_magento_notification"/>23 <button name="export_inventory" string="Export Stock Levels Only" colspan="1" type="object"/>
24 </field>24 <button name="export_images" string="Export Images" colspan="2" type="object" />
25 <button name="export_inventory" position="after">25 </group>
26 <button name="export_images" string="Export Images" colspan="2" type="object" />26 <group col="2" colspan="2">
27 </button>27 <field name="last_products_export_date" colspan="2"/>
28 <field name="last_inventory_export_date" position="after">28 <field name="last_special_products_export_date" colspan="2"/>
29 <field name="last_images_export_date" />29 <field name="last_category_export_date" colspan="2"/>
30 </field>30 <field name="last_inventory_export_date" colspan="2"/>
31 </data>31 <field name="last_images_export_date" />
32 </field>32 </group>
33 </record>33 </group>
3434 <group col="3" colspan="3">
35 <record id="act_magerp_shop_form" model="ir.actions.act_window">35 <separator string="Orders" colspan="3"/>
36 <field name="name">Magento Shops</field>36 <group col="4" colspan="3">
37 <field name="res_model">sale.shop</field>37 <button name="import_orders" string="Import Orders" colspan="1" type="object"/>
38 <field name="type">ir.actions.act_window</field>38 <button name="check_need_to_update" string="Check Payments from Channel" colspan="1" type="object"/>
39 <field name="view_type">form</field>39 <field name="import_orders_from_date" colspan="2"/>
40 <field name="view_mode">tree,form</field>40 </group>
41 <field name="domain">[('magento_shop', '=', True)]</field>41 <button name="update_orders" string="Update Orders State on Channel" colspan="1" type="object"/>
42 </record>42 <field name="last_update_order_export_date" colspan="2"/>
43 <button name="export_invoices" string="Export Invoices" colspan="1" type="object"/>
44 <button name="export_shipping" string="Export Shippings" colspan="1" type="object"/>
45 </group>
46 <separator string="Partners" colspan="3"/>
47 <newline/>
48 <button name="export_shop_partners" string="Export Partners" colspan="1" type="object"/>
49 <newline/>
50 </group>
51 </page>
52 </page>
53 <field name="shop_group_id" position="replace">
54 <field name="shop_group_id" readonly="True"/>
55 <field name="magento_root_category"/>
56 <field name="storeview_ids" nolabel="1" colspan="4"/>
57 <separator string="Magento Option" colspan="4"/>
58 <field name="magento_shop" />
59 <field name="allow_magento_order_status_push" />
60 <field name="allow_magento_notification"/>
61 </field>
62 </field>
63 </record>
64
65 <record id="act_magerp_shop_form" model="ir.actions.act_window">
66 <field name="name">Magento Shops</field>
67 <field name="res_model">sale.shop</field>
68 <field name="type">ir.actions.act_window</field>
69 <field name="view_type">form</field>
70 <field name="view_mode">tree,form</field>
71 <field name="domain">[['type_name', '=', 'Magento']]</field>
72 </record>
4373
44 <record id="base_sale_multichannel_view_order_form_magento" model="ir.ui.view">74 <record id="base_sale_multichannel_view_order_form_magento" model="ir.ui.view">
45 <field name="name">base_sale_multichannel_view_order_form.magento</field>75 <field name="name">base_sale_multichannel_view_order_form.magento</field>
@@ -59,6 +89,6 @@
59 </data>89 </data>
60 </field>90 </field>
61 </record>91 </record>
62 92
63 </data>93 </data>
64</openerp>94</openerp>
6595
=== removed file 'magentoerpconnect/server_tmp.patch'
--- magentoerpconnect/server_tmp.patch 2011-07-08 07:34:47 +0000
+++ magentoerpconnect/server_tmp.patch 1970-01-01 00:00:00 +0000
@@ -1,14 +0,0 @@
1=== modified file 'bin/osv/orm.py'
2--- bin/osv/orm.py 2011-05-24 10:18:10 +0000
3+++ bin/osv/orm.py 2011-06-07 20:17:29 +0000
4@@ -2449,6 +2450,9 @@
5 if k.startswith('x_') and not update_custom_fields:
6 continue
7
8+ if k.startswith('x_js_'):
9+ continue
10+
11 f = self._columns[k]
12
13 if isinstance(f, fields.one2many):
14
150
=== modified file 'magentoerpconnect/settings/1.3.2.4/external.mappinglines.template.csv'
--- magentoerpconnect/settings/1.3.2.4/external.mappinglines.template.csv 2012-05-24 19:50:22 +0000
+++ magentoerpconnect/settings/1.3.2.4/external.mappinglines.template.csv 2012-12-03 15:22:20 +0000
@@ -41,16 +41,16 @@
41 clean = re.sub('\w:\w:|\w:\w+;', '', ifield)41 clean = re.sub('\w:\w:|\w:\w+;', '', ifield)
42 for each in clean.split('{'):42 for each in clean.split('{'):
43 if each.startswith('""label""'):43 if each.startswith('""label""'):
44 split_info = each.split(';') 44 split_info = each.split(';')
45 options_label.append('%s: %s [%s]' % (split_info[1], split_info[3], data['sku']))45 options_label.append('%s: %s [%s]' % (split_info[1], split_info[3], data['sku']))
46 46
47 result=[('notes', """".join(options_label).replace('""""', '\n').replace('""', ''))]47 result=[('notes', """".join(options_label).replace('""""', '\n').replace('""', ''))]
48",48",
49"mag_1324_erp_soline_pid","magento1324","sale.model_sale_order_line","product_id",,"in_out","function","unicode",,"context['alternative_key'] = data['sku']49"mag_1324_erp_soline_pid","magento1324","sale.model_sale_order_line","product_id",,"in_out","function","unicode",,"context['alternative_key'] = data['sku']
50result=[('product_id',self.pool.get('product.product').extid_to_oeid(cr, uid, external_session, ifield, referential_id))]",50result=[('product_id',self.pool.get('product.product').extid_to_oeid(cr, uid, external_session, ifield, referential_id))]",
51"mag_1324_erp_soline_uomqty","magento1324","sale.model_sale_order_line","qty_ordered",,"in_out","function","unicode",,"result=[('product_uom_qty',ifield)]",51"mag_1324_erp_soline_uomqty","magento1324","sale.model_sale_order_line","qty_ordered",,"in_out","function","unicode",,"result=[('product_uom_qty',ifield)]",
52"mag_1324_erp_soline_uosqty","magento1324","sale.model_sale_order_line","qty_ordered",,"in","function","unicode",,"result=[('product_uos_qty',ifield)]",52"mag_1324_erp_soline_uosqty","magento1324","sale.model_sale_order_line","qty_ordered",,"in","function","unicode",,"result=[('product_uos_qty',ifield)]",
53"mag_1324_erp_soline_price","magento1324","sale.model_sale_order_line","price",,"in","function","unicode",,"if context.get('price_is_tax_included', False): 53"mag_1324_erp_soline_price","magento1324","sale.model_sale_order_line","price",,"in","function","unicode",,"if context.get('price_is_tax_included', False):
54 result=[('price_unit', (float(data['row_total']) + float(data['tax_amount']))/float(data['qty_ordered']))]54 result=[('price_unit', (float(data['row_total']) + float(data['tax_amount']))/float(data['qty_ordered']))]
55else:55else:
56 result=[('price_unit', float(data['row_total'])/float(data['qty_ordered']))]",56 result=[('price_unit', float(data['row_total'])/float(data['qty_ordered']))]",
@@ -60,16 +60,16 @@
60"mag_1324_erp_procat_3","magento1324","product.model_product_category","parent_id",,"in_out","function","int",,"record_id = self.pool.get('ir.model.data').search(cr, uid, [('model', '=', self._name), ('name', '=', self.prefixed_id(ifield))])60"mag_1324_erp_procat_3","magento1324","product.model_product_category","parent_id",,"in_out","function","int",,"record_id = self.pool.get('ir.model.data').search(cr, uid, [('model', '=', self._name), ('name', '=', self.prefixed_id(ifield))])
61parent_id = False61parent_id = False
62if record_id:62if record_id:
63 parent_rec = self.pool.get('ir.model.data').read(cr,uid,record_id[0],[])63 parent_rec = self.pool.get('ir.model.data').read(cr,uid,record_id[0],[])
64 parent_id=parent_rec.get('res_id',False)64 parent_id=parent_rec.get('res_id',False)
65result=[('magento_parent_id',ifield),('parent_id',parent_id)]","magento_parent_id = False65result=[('magento_parent_id',ifield),('parent_id',parent_id)]","magento_parent_id = False
66if record.get('parent_id',False):66if record.get('parent_id',False):
67 magento_parent_id = self.oeid_to_extid(cr, uid, record.get('parent_id')[0], referential_id)67 magento_parent_id = self.oeid_to_extid(cr, uid, record.get('parent_id')[0], referential_id)
68 if not magento_parent_id:68 if not magento_parent_id:
69 self.ext_export(cr,uid,[record.get('parent_id',[False])[0]],[referential_id],{},context=context)69 self.ext_export(cr,uid,[record.get('parent_id',[False])[0]],[referential_id],{},context=context)
70 magento_parent_id = self.oeid_to_extid(cr, uid, record.get('parent_id')[0], referential_id)70 magento_parent_id = self.oeid_to_extid(cr, uid, record.get('parent_id')[0], referential_id)
71if magento_parent_id:71if magento_parent_id:
72 result = [('parent_id',magento_parent_id)]"72 result = [('parent_id',magento_parent_id)]"
73"mag_1324_erp_procat_4","magento1324","product.model_product_category","is_active",,"in_out","function","unicode",,"result=[('is_active',ifield and (eval(ifield)) or False)]","result=[('is_active',record['is_active'])]"73"mag_1324_erp_procat_4","magento1324","product.model_product_category","is_active",,"in_out","function","unicode",,"result=[('is_active',ifield and (eval(ifield)) or False)]","result=[('is_active',record['is_active'])]"
74"mag_1324_erp_procat_5","magento1324","product.model_product_category","description",,"in_out","function","unicode",,"result=[('description',ifield)]","result=[('description',record['description'])]"74"mag_1324_erp_procat_5","magento1324","product.model_product_category","description",,"in_out","function","unicode",,"result=[('description',ifield)]","result=[('description',record['description'])]"
75"mag_1324_erp_procat_6","magento1324","product.model_product_category","meta_title",,"in_out","function","unicode",,"result=[('meta_title',ifield)]","result=[('meta_title',record['meta_title'])]"75"mag_1324_erp_procat_6","magento1324","product.model_product_category","meta_title",,"in_out","function","unicode",,"result=[('meta_title',ifield)]","result=[('meta_title',record['meta_title'])]"
@@ -102,20 +102,20 @@
102"mag_1324_erp_procat_14","magento1324","product.model_product_category","updated_at",,"in","function","unicode",,"result=[('magerp_stamp',ifield)]",102"mag_1324_erp_procat_14","magento1324","product.model_product_category","updated_at",,"in","function","unicode",,"result=[('magerp_stamp',ifield)]",
103"mag_1324_erp_procat_15","magento1324","product.model_product_category","image",,"in_out","function","unicode",,"image_binary = False103"mag_1324_erp_procat_15","magento1324","product.model_product_category","image",,"in_out","function","unicode",,"image_binary = False
104if ifield and not ifield=='None':104if ifield and not ifield=='None':
105 try:105 try:
106 image_binary = conn.call('ol_catalog_category_media.info', [int(data['category_id'])])106 image_binary = conn.call('ol_catalog_category_media.info', [int(data['category_id'])])
107 except Exception, e:107 except Exception, e:
108 print e108 print e
109 pass109 pass
110 if image_binary:110 if image_binary:
111 image_binary = base64.encodestring(base64.urlsafe_b64decode(image_binary[0]['image_data']))111 image_binary = base64.encodestring(base64.urlsafe_b64decode(image_binary[0]['image_data']))
112result=[('image_name',ifield),('image',image_binary)]","if record['image']:112result=[('image_name',ifield),('image',image_binary)]","if record['image']:
113 img = base64.decodestring(record['image'])113 img = base64.decodestring(record['image'])
114 img_bin_enc = base64.encodestring(img) 114 img_bin_enc = base64.encodestring(img)
115 conn.call('ol_catalog_category_media.create', [record['image_name'], img_bin_enc])115 conn.call('ol_catalog_category_media.create', [record['image_name'], img_bin_enc])
116 result = [('image',record['image_name'])]116 result = [('image',record['image_name'])]
117else:117else:
118 result=[]"118 result=[]"
119"mag_1324_erp_procat_16","magento1324","product.model_product_category","include_in_menu",,"in_out","function","unicode",,"result=[('include_in_menu', ifield and (eval(ifield)) or False)]","result=[('include_in_menu',record['include_in_menu'])]"119"mag_1324_erp_procat_16","magento1324","product.model_product_category","include_in_menu",,"in_out","function","unicode",,"result=[('include_in_menu', ifield and (eval(ifield)) or False)]","result=[('include_in_menu',record['include_in_menu'])]"
120"mag_1324_erp_procat_17","magento1324","product.model_product_category","page_layout",,"in_out","function","unicode",,"if ifield:120"mag_1324_erp_procat_17","magento1324","product.model_product_category","page_layout",,"in_out","function","unicode",,"if ifield:
121 att_id = self.pool.get('magerp.product_category_attribute_options').get_create_option_id(cr, uid, ifield,'page_layout', context=context)121 att_id = self.pool.get('magerp.product_category_attribute_options').get_create_option_id(cr, uid, ifield,'page_layout', context=context)
@@ -226,52 +226,52 @@
226"magento_1324_prt_adr_6","magento1324","base.model_res_partner_address","is_active",,"in_out","function","unicode",,"result=[('active',bool(eval(ifield)))]",226"magento_1324_prt_adr_6","magento1324","base.model_res_partner_address","is_active",,"in_out","function","unicode",,"result=[('active',bool(eval(ifield)))]",
227"magento_1324_prt_adr_7","magento1324","base.model_res_partner_address","country_id",,"in_out","function","unicode",,"result = self.pool.get('res.country').search(cr,uid,[('code','=',ifield)])227"magento_1324_prt_adr_7","magento1324","base.model_res_partner_address","country_id",,"in_out","function","unicode",,"result = self.pool.get('res.country').search(cr,uid,[('code','=',ifield)])
228if result and len(result)==1:228if result and len(result)==1:
229 result=[('country_id',result[0])]229 result=[('country_id',result[0])]
230else:230else:
231 result=[]231 result=[]
232",232",
233"magento_1324_prt_adr_8","magento1324","base.model_res_partner_address","street",,"in_out","function","unicode",,"if ifield:233"magento_1324_prt_adr_8","magento1324","base.model_res_partner_address","street",,"in_out","function","unicode",,"if ifield:
234 if len(ifield.split('\n')) ==2 :234 if len(ifield.split('\n')) ==2 :
235 result = [('street', ifield.split('\n')[0]) , ('street2', ifield.split('\n')[1])]235 result = [('street', ifield.split('\n')[0]) , ('street2', ifield.split('\n')[1])]
236 else :236 else :
237 result = [('street',ifield.replace('\\n',','))]237 result = [('street',ifield.replace('\\n',','))]
238else:238else:
239 result = []",239 result = []",
240"magento_1324_prt_adr_9","magento1324","base.model_res_partner_address","postcode",,"in_out","function","unicode",,"result=[('zip',ifield)]",240"magento_1324_prt_adr_9","magento1324","base.model_res_partner_address","postcode",,"in_out","function","unicode",,"result=[('zip',ifield)]",
241"magento_1324_prt_adr_10","magento1324","base.model_res_partner_address","telephone",,"in_out","function","unicode",,"result=[('phone',ifield)]",241"magento_1324_prt_adr_10","magento1324","base.model_res_partner_address","telephone",,"in_out","function","unicode",,"result=[('phone',ifield)]",
242"magento_1324_prt_adr_11","magento1324","base.model_res_partner_address","region",,"in_out","function","unicode",,"if ifield:242"magento_1324_prt_adr_11","magento1324","base.model_res_partner_address","region",,"in_out","function","unicode",,"if ifield:
243 result = self.pool.get('res.country.state').search(cr,uid,[('name','ilike',ifield)])243 result = self.pool.get('res.country.state').search(cr,uid,[('name','ilike',ifield)])
244 if result and len(result)==1:244 if result and len(result)==1:
245 result = [('state_id',result[0])]245 result = [('state_id',result[0])]
246 else:246 else:
247 result=[]247 result=[]
248else:248else:
249 result=[]",249 result=[]",
250"magento_1324_prt_adr_13","magento1324","base.model_res_partner_address","customer_id",,"in_out","function","int",,"result=self.pool.get('res.partner').extid_to_oeid(cr,uid,ifield,referential_id)250"magento_1324_prt_adr_13","magento1324","base.model_res_partner_address","customer_id",,"in_out","function","int",,"result=self.pool.get('res.partner').extid_to_oeid(cr,uid,ifield,referential_id)
251if result:251if result:
252 result=[('partner_id',result)]252 result=[('partner_id',result)]
253else:253else:
254 result=[('partner_id',False)]",254 result=[('partner_id',False)]",
255"magento_1324_prt_adr_14","magento1324","base.model_res_partner_address","address_type",,"in_out","function","unicode",,"if ifield=='billing':255"magento_1324_prt_adr_14","magento1324","base.model_res_partner_address","address_type",,"in_out","function","unicode",,"if ifield=='billing':
256 result=[('type','invoice')]256 result=[('type','invoice')]
257elif ifield=='shipping':257elif ifield=='shipping':
258 result=[('type','delivery')]258 result=[('type','delivery')]
259else:259else:
260 result=[]",260 result=[]",
261"magento_1324_prt_adr_15","magento1324","base.model_res_partner_address","email",,"in_out","function","unicode",,"result=[('email',ifield)]",261"magento_1324_prt_adr_15","magento1324","base.model_res_partner_address","email",,"in_out","function","unicode",,"result=[('email',ifield)]",
262"magento_1324_prt_2","magento1324","base.model_res_partner","group_id",,"in_out","function","int",,"if ifield:262"magento_1324_prt_2","magento1324","base.model_res_partner","group_id",,"in_out","function","int",,"if ifield:
263 result=self.pool.get('res.partner.category').extid_to_oeid(cr,uid,ifield,referential_id)263 result=self.pool.get('res.partner.category').extid_to_oeid(cr,uid,ifield,referential_id)
264 if result:264 if result:
265 result=[('group_id',result)]",265 result=[('group_id',result)]",
266"magento_1324_prt_3","magento1324","base.model_res_partner","store_id",,"in_out","function","int",,"if ifield:266"magento_1324_prt_3","magento1324","base.model_res_partner","store_id",,"in_out","function","int",,"if ifield:
267 result=self.pool.get('magerp.storeviews').extid_to_oeid(cr,uid,ifield,referential_id)267 result=self.pool.get('magerp.storeviews').extid_to_oeid(cr,uid,ifield,referential_id)
268 if result:268 if result:
269 lang = self.pool.get('magerp.storeviews').browse(cr, uid, result).lang_id269 lang = self.pool.get('magerp.storeviews').browse(cr, uid, result).lang_id
270 result=[('store_id',result),('lang',lang and lang.code or False)]",270 result=[('store_id',result),('lang',lang and lang.code or False)]",
271"magento_1324_prt_4","magento1324","base.model_res_partner","website_id",,"in_out","function","int",,"if ifield:271"magento_1324_prt_4","magento1324","base.model_res_partner","website_id",,"in_out","function","int",,"if ifield:
272 result=self.pool.get('external.shop.group').extid_to_oeid(cr,uid,ifield,referential_id)272 result=self.pool.get('external.shop.group').extid_to_oeid(cr,uid,ifield,referential_id)
273 if result:273 if result:
274 result=[('website_id',result)]",274 result=[('website_id',result)]",
275"magento_1324_prt_5","magento1324","base.model_res_partner","created_in",,"in_out","function","unicode",,"result=[('created_in',ifield)]",275"magento_1324_prt_5","magento1324","base.model_res_partner","created_in",,"in_out","function","unicode",,"result=[('created_in',ifield)]",
276"magento_1324_prt_6","magento1324","base.model_res_partner","created_at",,"in_out","function","unicode",,"result=[('created_at',ifield)]",276"magento_1324_prt_6","magento1324","base.model_res_partner","created_at",,"in_out","function","unicode",,"result=[('created_at',ifield)]",
277"magento_1324_prt_7","magento1324","base.model_res_partner","updated_at",,"in_out","function","unicode",,"result=[('updated_at',ifield)]",277"magento_1324_prt_7","magento1324","base.model_res_partner","updated_at",,"in_out","function","unicode",,"result=[('updated_at',ifield)]",
@@ -281,10 +281,10 @@
281result=[('firstname', fn), ('lastname', ln)]"281result=[('firstname', fn), ('lastname', ln)]"
282"magento_1324_prt_10","magento1324","base.model_res_partner","email",,"in_out","function","unicode",,"result=[('emailid',ifield)]",282"magento_1324_prt_10","magento1324","base.model_res_partner","email",,"in_out","function","unicode",,"result=[('emailid',ifield)]",
283"magento_1324_prt_11","magento1324","base.model_res_partner","taxvat",,"in_out","function","unicode",,"if ifield:283"magento_1324_prt_11","magento1324","base.model_res_partner","taxvat",,"in_out","function","unicode",,"if ifield:
284 result=[('mag_vat',ifield)]284 result=[('mag_vat',ifield)]
285else:285else:
286 result=[]",286 result=[]",
287"magento_1324_prt_12","magento1324","base.model_res_partner","dob",,"in_out","function","unicode",,"if ifield:287"magento_1324_prt_12","magento1324","base.model_res_partner","dob",,"in_out","function","unicode",,"if ifield:
288 result =[('mag_birthday',ifield[:10])]288 result =[('mag_birthday',ifield[:10])]
289else:289else:
290 result=[]",290 result=[]",
291291
=== modified file 'magentoerpconnect/settings/1.5.0.0/product.category/external.mappinglines.template.csv'
--- magentoerpconnect/settings/1.5.0.0/product.category/external.mappinglines.template.csv 2012-05-07 20:54:47 +0000
+++ magentoerpconnect/settings/1.5.0.0/product.category/external.mappinglines.template.csv 2012-12-03 15:22:20 +0000
@@ -43,17 +43,17 @@
43magentoerpconnect.mag1500_product_category_is_anchor,magentoerpconnect.mag1500_product_category,is_anchor,magentoerpconnect.field_product_category_is_anchor,in_out,direct,int,,False,,43magentoerpconnect.mag1500_product_category_is_anchor,magentoerpconnect.mag1500_product_category,is_anchor,magentoerpconnect.field_product_category_is_anchor,in_out,direct,int,,False,,
44magentoerpconnect.mag1500_product_category_image,magentoerpconnect.mag1500_product_category,image,,in_out,function,unicode,,False,"image_binary = False44magentoerpconnect.mag1500_product_category_image,magentoerpconnect.mag1500_product_category,image,,in_out,function,unicode,,False,"image_binary = False
45if resource['image'] and not resource['image']=='None':45if resource['image'] and not resource['image']=='None':
46 try:46 try:
47 image_binary = conn.call('ol_catalog_category_media.info', [int(data['category_id'])])47 image_binary = conn.call('ol_catalog_category_media.info', [int(data['category_id'])])
48 except Exception, e:48 except Exception, e:
49 print e49 print e
50 pass50 pass
51 if image_binary:51 if image_binary:
52 image_binary = base64.encodestring(base64.urlsafe_b64decode(image_binary[0]['image_data']))52 image_binary = base64.encodestring(base64.urlsafe_b64decode(image_binary[0]['image_data']))
53result=[('image_name',ifield),('image',image_binary)]","if 'image' in resource:53result=[('image_name',ifield),('image',image_binary)]","if 'image' in resource:
54 if resource['image']:54 if resource['image']:
55 img = base64.decodestring(record['image'])55 img = base64.decodestring(record['image'])
56 img_bin_enc = base64.encodestring(img) 56 img_bin_enc = base64.encodestring(img)
57 conn.call('ol_catalog_category_media.create', [record['image_name'], img_bin_enc])57 conn.call('ol_catalog_category_media.create', [record['image_name'], img_bin_enc])
58 result = [('image',record['image_name'])]58 result = [('image',record['image_name'])]
59 else:59 else:
6060
=== modified file 'magentoerpconnect/settings/1.5.0.0/product/external.mappinglines.template.csv'
--- magentoerpconnect/settings/1.5.0.0/product/external.mappinglines.template.csv 2012-06-21 16:17:58 +0000
+++ magentoerpconnect/settings/1.5.0.0/product/external.mappinglines.template.csv 2012-12-03 15:22:20 +0000
@@ -59,7 +59,7 @@
59 mag_categ_id = cat_obj.get_or_create_extid(cr, uid, external_session, categ_id, context=context)59 mag_categ_id = cat_obj.get_or_create_extid(cr, uid, external_session, categ_id, context=context)
60 mag_categ_ids.append(mag_categ_id)60 mag_categ_ids.append(mag_categ_id)
61 result=[('categories', mag_categ_ids)]",,61 result=[('categories', mag_categ_ids)]",,
62"mag1500_product_product_special_price",,"in_out","function","special_price",,"float","False","magentoerpconnect.mag1500_product_product","special_price","if 'x_magerp_special_price' in resource: result = [('x_magerp_special_price', ifield)]","if 'x_magerp_special_price' in resource: 62"mag1500_product_product_special_price",,"in_out","function","special_price",,"float","False","magentoerpconnect.mag1500_product_product","special_price","if 'x_magerp_special_price' in resource: result = [('x_magerp_special_price', ifield)]","if 'x_magerp_special_price' in resource:
63 if resource['x_magerp_special_price']:63 if resource['x_magerp_special_price']:
64 result = [('special_price', resource['x_magerp_special_price'])]64 result = [('special_price', resource['x_magerp_special_price'])]
65 else:65 else:
6666
=== modified file 'magentoerpconnect/settings/1.5.0.0/res.partner.address/external.mappinglines.template.csv'
--- magentoerpconnect/settings/1.5.0.0/res.partner.address/external.mappinglines.template.csv 2012-05-19 17:26:11 +0000
+++ magentoerpconnect/settings/1.5.0.0/res.partner.address/external.mappinglines.template.csv 2012-12-03 15:22:20 +0000
@@ -1,5 +1,17 @@
1id,sequence,type,evaluation_type,external_field,field_id:id,external_type,alternative_key,mapping_id:id,function_name,in_function,out_function,child_mapping_id:id,datetime_format1id,sequence,type,evaluation_type,external_field,field_id:id,external_type,alternative_key,mapping_id:id,function_name,in_function,out_function,child_mapping_id:id,datetime_format
2magentoerpconnect.mag1500_res_partner_address_name,,in_out,direct,firstname,magentoerpconnect.field_res_partner_address_firstname,unicode,True,magentoerpconnect.mag1500_res_partner_address,name,,,,2magentoerpconnect.mag1500_res_partner_address_name,,in_out,function,firstname,base.field_res_partner_address_name,unicode,True,magentoerpconnect.mag1500_res_partner_address,name,"if 'firstname' in resource or 'lastname' in resource:
3 result = [('name', (resource.get('firstname') or '') + (resource.get('firstname') and ' ' or '') + (resource.get('lastname') or ''))]","if 'name' in resource:
4 name_split = name.split(' ')
5 if len(name_split) >= 2:
6 firstname = name_split[0]
7 lastname = name.replace(firstname, '').strip()
8 else:
9 firstname = '-'
10 lastname = name
11else:
12 firstname = ''
13 lastname = ''
14result = [('firstname', firstname), ('lastname', lastname)]",,
3magentoerpconnect.mag1500_res_partner_address_telephone,,in_out,direct,telephone,base.field_res_partner_address_phone,unicode,False,magentoerpconnect.mag1500_res_partner_address,,,,,15magentoerpconnect.mag1500_res_partner_address_telephone,,in_out,direct,telephone,base.field_res_partner_address_phone,unicode,False,magentoerpconnect.mag1500_res_partner_address,,,,,
4magentoerpconnect.mag1500_res_partner_address_region,,in_out,function,region,,unicode,False,magentoerpconnect.mag1500_res_partner_address,region,"if ifield:16magentoerpconnect.mag1500_res_partner_address_region,,in_out,function,region,,unicode,False,magentoerpconnect.mag1500_res_partner_address,region,"if ifield:
5 result = self.pool.get('res.country.state').search(cr,uid,[('name','ilike',ifield)])17 result = self.pool.get('res.country.state').search(cr,uid,[('name','ilike',ifield)])
@@ -42,7 +54,6 @@
42 result = [('prefix',resource['title'][1])]",,54 result = [('prefix',resource['title'][1])]",,
43magentoerpconnect.mag1500_res_partner_address_city,,in_out,direct,city,base.field_res_partner_address_city,unicode,True,magentoerpconnect.mag1500_res_partner_address,,"result=[('city',ifield)]",,,55magentoerpconnect.mag1500_res_partner_address_city,,in_out,direct,city,base.field_res_partner_address_city,unicode,True,magentoerpconnect.mag1500_res_partner_address,,"result=[('city',ifield)]",,,
44magentoerpconnect.mag1500_res_partner_address_fax,,in_out,direct,fax,base.field_res_partner_address_fax,unicode,False,magentoerpconnect.mag1500_res_partner_address,,,,,56magentoerpconnect.mag1500_res_partner_address_fax,,in_out,direct,fax,base.field_res_partner_address_fax,unicode,False,magentoerpconnect.mag1500_res_partner_address,,,,,
45magentoerpconnect.mag1500_res_partner_address_lastname,,in_out,direct,lastname,magentoerpconnect.field_res_partner_address_lastname,unicode,False,magentoerpconnect.mag1500_res_partner_address,,,,,
46mag1500_res_partner_address_email,,in_out,direct,email,base.field_res_partner_address_email,unicode,False,magentoerpconnect.mag1500_res_partner_address,,,,,57mag1500_res_partner_address_email,,in_out,direct,email,base.field_res_partner_address_email,unicode,False,magentoerpconnect.mag1500_res_partner_address,,,,,
47mag1500_res_partner_address_company,,in_out,direct,company,magentoerpconnect.field_res_partner_address_company,unicode,True,magentoerpconnect.mag1500_res_partner_address,,,,,58mag1500_res_partner_address_company,,in_out,direct,company,magentoerpconnect.field_res_partner_address_company,unicode,True,magentoerpconnect.mag1500_res_partner_address,,,,,
48magentoerpconnect.mag1500_res_partner_address_zip,,in_out,direct,postcode,base.field_res_partner_address_zip,unicode,True,magentoerpconnect.mag1500_res_partner_address,,"result=[('zip',ifield)]",,,59magentoerpconnect.mag1500_res_partner_address_zip,,in_out,direct,postcode,base.field_res_partner_address_zip,unicode,True,magentoerpconnect.mag1500_res_partner_address,,"result=[('zip',ifield)]",,,
4960
=== modified file 'magentoerpconnect/settings/1.5.0.0/res.partner/external.mappinglines.template.csv'
--- magentoerpconnect/settings/1.5.0.0/res.partner/external.mappinglines.template.csv 2012-08-14 14:53:28 +0000
+++ magentoerpconnect/settings/1.5.0.0/res.partner/external.mappinglines.template.csv 2012-12-03 15:22:20 +0000
@@ -11,7 +11,8 @@
11mag1500_res_partner_created_in,,in_out,direct,created_in,magentoerpconnect.field_res_partner_created_in,unicode,False,magentoerpconnect.mag1500_res_partner,,,,,11mag1500_res_partner_created_in,,in_out,direct,created_in,magentoerpconnect.field_res_partner_created_in,unicode,False,magentoerpconnect.mag1500_res_partner,,,,,
12mag1500_res_partner_created_at,,in_out,direct,created_at,magentoerpconnect.field_res_partner_created_at,unicode,False,magentoerpconnect.mag1500_res_partner,,,,,12mag1500_res_partner_created_at,,in_out,direct,created_at,magentoerpconnect.field_res_partner_created_at,unicode,False,magentoerpconnect.mag1500_res_partner,,,,,
13mag1500_res_partner_updated_at,,in_out,direct,updated_at,magentoerpconnect.field_res_partner_updated_at,unicode,False,magentoerpconnect.mag1500_res_partner,,,,,%Y-%m-%d %H:%M:%S13mag1500_res_partner_updated_at,,in_out,direct,updated_at,magentoerpconnect.field_res_partner_updated_at,unicode,False,magentoerpconnect.mag1500_res_partner,,,,,%Y-%m-%d %H:%M:%S
14mag1500_res_partner_name,,in_out,function,firstname,,unicode,False,magentoerpconnect.mag1500_res_partner,name,"result = [('name',resource['firstname'] + ' ' + resource['lastname'])]","add_id = self.browse(cr, uid, resource['id'])14mag1500_res_partner_name,,in_out,function,firstname,,unicode,False,magentoerpconnect.mag1500_res_partner,name,"if 'firstname' in resource or 'lastname' in resource:
15 result = [('name', (resource.get('firstname') or '') + (resource.get('firstname') and ' ' or '') + (resource.get('lastname') or ''))]","add_id = self.browse(cr, uid, resource['id'])
15fn = add_id.address[0].firstname16fn = add_id.address[0].firstname
16ln = add_id.address[0].lastname17ln = add_id.address[0].lastname
17result=[('firstname', fn), ('lastname', ln)]",,18result=[('firstname', fn), ('lastname', ln)]",,
1819
=== modified file 'magentoerpconnect/settings/1.5.0.0/sale.order.line/external.mappinglines.template.csv'
--- magentoerpconnect/settings/1.5.0.0/sale.order.line/external.mappinglines.template.csv 2012-08-20 21:52:00 +0000
+++ magentoerpconnect/settings/1.5.0.0/sale.order.line/external.mappinglines.template.csv 2012-12-03 15:22:20 +0000
@@ -9,9 +9,9 @@
9 clean = re.sub('\w:\w:|\w:\w+;', '', ifield)9 clean = re.sub('\w:\w:|\w:\w+;', '', ifield)
10 for each in clean.split('{'):10 for each in clean.split('{'):
11 if each.startswith('""label""'):11 if each.startswith('""label""'):
12 split_info = each.split(';') 12 split_info = each.split(';')
13 options_label.append('%s: %s [%s]' % (split_info[1], split_info[3], data['sku']))13 options_label.append('%s: %s [%s]' % (split_info[1], split_info[3], data['sku']))
14 14
15 result=[('notes', """".join(options_label).replace('""""', '\n').replace('""', ''))]15 result=[('notes', """".join(options_label).replace('""""', '\n').replace('""', ''))]
16",,,16",,,
17mag1500_sale_order_line_product_id=>,,in,direct,product_id,sale.field_sale_order_line_product_id,int,False,mag1500_sale_order_line,,,,,17mag1500_sale_order_line_product_id=>,,in,direct,product_id,sale.field_sale_order_line_product_id,int,False,mag1500_sale_order_line,,,,,
@@ -21,3 +21,4 @@
21('price_unit_tax_excluded', (float(resource['base_row_total']))/float(resource['qty_ordered'])),21('price_unit_tax_excluded', (float(resource['base_row_total']))/float(resource['qty_ordered'])),
22('tax_rate', float(resource['base_row_total']) and (float(resource['base_row_total_incl_tax'])/float(resource['base_row_total'])-1)),22('tax_rate', float(resource['base_row_total']) and (float(resource['base_row_total_incl_tax'])/float(resource['base_row_total'])-1)),
23]",,,23]",,,
24mag1500_sale_order_line_id,,in,direct,item_id,base_sale_multichannels.field_sale_order_line_ext_ref_line,int,False,mag1500_sale_order_line,,,,,
2425
=== modified file 'magentoerpconnect/settings/1.5.0.0/sale.order/external.mappinglines.template.csv'
--- magentoerpconnect/settings/1.5.0.0/sale.order/external.mappinglines.template.csv 2012-08-14 14:53:28 +0000
+++ magentoerpconnect/settings/1.5.0.0/sale.order/external.mappinglines.template.csv 2012-12-03 15:22:20 +0000
@@ -16,7 +16,6 @@
16mag1500_sale_order_cod_fee=>,,in,function,cod_fee,,float,False,mag1500_sale_order,cod_fee,"#TODO map me16mag1500_sale_order_cod_fee=>,,in,function,cod_fee,,float,False,mag1500_sale_order,cod_fee,"#TODO map me
17",,,17",,,
18mag1500_sale_order_gift_certificates_amount=>,,in,function,giftcert_amount,,float,False,mag1500_sale_order,gift_certificates_amount,"result=[('gift_certificates_amount', ifield)]",,,18mag1500_sale_order_gift_certificates_amount=>,,in,function,giftcert_amount,,float,False,mag1500_sale_order,gift_certificates_amount,"result=[('gift_certificates_amount', ifield)]",,,
19mag1500_sale_order_shipping_amount_tax_excluded=>,,in,function,shipping_amount,,float,False,mag1500_sale_order,shipping_amount_tax_excluded,"result=[('shipping_amount_tax_excluded', ifield)]",,,
20mag1500_sale_order_gift_certificates_code=>,,in,function,giftcert_code,,unicode,False,mag1500_sale_order,gift_certificates_code,"result = [('gift_certificates_code', ifield)]",,,19mag1500_sale_order_gift_certificates_code=>,,in,function,giftcert_code,,unicode,False,mag1500_sale_order,gift_certificates_code,"result = [('gift_certificates_code', ifield)]",,,
21mag1500_sale_order_carrier_id=>,,in,function,shipping_method,,unicode,False,mag1500_sale_order,carrier_id,"if ifield:20mag1500_sale_order_carrier_id=>,,in,function,shipping_method,,unicode,False,mag1500_sale_order,carrier_id,"if ifield:
22 carrier_ids = self.pool.get('delivery.carrier').search(cr, uid, [('magento_code', '=', ifield)])21 carrier_ids = self.pool.get('delivery.carrier').search(cr, uid, [('magento_code', '=', ifield)])
@@ -28,5 +27,17 @@
28 model, product_id = model_data_obj.get_object_reference(cr, uid, 'base_sale_multichannels', 'product_product_shipping')27 model, product_id = model_data_obj.get_object_reference(cr, uid, 'base_sale_multichannels', 'product_product_shipping')
29 carrier_id = self.pool.get('delivery.carrier').create(cr, uid, {'partner_id' : fake_partner_id, 'product_id' : product_id, 'name' : ifield, 'magento_code' : ifield})28 carrier_id = self.pool.get('delivery.carrier').create(cr, uid, {'partner_id' : fake_partner_id, 'product_id' : product_id, 'name' : ifield, 'magento_code' : ifield})
30 result=[('carrier_id', carrier_id)]",,,29 result=[('carrier_id', carrier_id)]",,,
31mag1500_sale_order_shipping_amount_tax_included=>,,in,function,base_shipping_incl_tax,,float,False,mag1500_sale_order,shipping_amount_tax_included,"result=[('shipping_amount_tax_included', ifield), ('shipping_tax_rate', ifield and (ifield/float(data['shipping_amount'])-1)) or 0]",,,30mag1500_sale_order_shipping_amount_tax_included=>,,in,function,base_shipping_incl_tax,,float,False,mag1500_sale_order,shipping_amount_tax_included,"amount_tax_inc = float(resource.get('base_shipping_incl_tax', 0.0)) - float(resource.get('shipping_discount_amount', 0.0))
32mag1500_s ale_order_date,,in,direct,created_at,sale.field_sale_order_date_order,datetime,False,mag1500_sale_order,,,,,%Y-%m-%d %H:%M:%S31amount_tax_exc = float(resource.get('shipping_amount', 0))
32
33if amount_tax_exc:
34 tax_rate = amount_tax_inc/amount_tax_exc -1
35else:
36 tax_rate = 0
37
38result=[
39 ('shipping_amount_tax_included', amount_tax_inc),
40 ('shipping_amount_tax_excluded', amount_tax_exc),
41 ('shipping_tax_rate', tax_rate),
42]",,,
43mag1500_sale_order_date,,in,direct,created_at,sale.field_sale_order_date_order,datetime,False,mag1500_sale_order,,,,,%Y-%m-%d %H:%M:%S
3344
=== modified file 'magentoerpconnect/stock.py'
--- magentoerpconnect/stock.py 2012-05-25 15:37:26 +0000
+++ magentoerpconnect/stock.py 2012-12-03 15:22:20 +0000
@@ -21,15 +21,14 @@
2121
22import xmlrpclib22import xmlrpclib
2323
24from osv import fields,osv24from openerp.osv.orm import Model
25from tools.translate import _25from openerp.tools.translate import _
26from openerp.addons.base_sale_multichannels.sale import \26from base_sale_multichannels.sale import ExternalShippingCreateError
27 ExternalShippingCreateError
2827
29import logging28import logging
30_logger = logging.getLogger(__name__)29_logger = logging.getLogger(__name__)
3130
32class stock_picking(osv.osv):31class stock_picking(Model):
3332
34 _inherit = "stock.picking"33 _inherit = "stock.picking"
3534
@@ -122,5 +121,3 @@
122 if res:121 if res:
123 _logger.info("Successfully adding a tracking reference to the shipping with OpenERP id %s and ext id %s in external sale system", id, ext_shipping_id)122 _logger.info("Successfully adding a tracking reference to the shipping with OpenERP id %s and ext id %s in external sale system", id, ext_shipping_id)
124 return True123 return True
125
126stock_picking()
127124
=== modified file 'magentoerpconnect/wizard/open_product_by_attribut_set.py'
--- magentoerpconnect/wizard/open_product_by_attribut_set.py 2011-12-17 20:57:57 +0000
+++ magentoerpconnect/wizard/open_product_by_attribut_set.py 2012-12-03 15:22:20 +0000
@@ -19,13 +19,13 @@
19# #19# #
20#################################################################################20#################################################################################
2121
22from osv import fields,osv22from openerp.osv.orm import TransientModel
2323from openerp.osv import fields
2424
25class open_product_by_attribut_set(osv.osv_memory):25
26class open_product_by_attribut_set(TransientModel):
26 _name = 'open.product.by.attribut.set'27 _name = 'open.product.by.attribut.set'
27 _description = 'Wizard to open product by attributs set'28 _description = 'Wizard to open product by attributs set'
28
29 _columns = {29 _columns = {
30 'attributs_set':fields.many2one('magerp.product_attribute_set', 'Attributs Set'),30 'attributs_set':fields.many2one('magerp.product_attribute_set', 'Attributs Set'),
31 }31 }
@@ -51,5 +51,3 @@
51 result['domain'] = "[('set', '=', %s)]" % attribute_set.id51 result['domain'] = "[('set', '=', %s)]" % attribute_set.id
52 result['name'] = attribute_set.attribute_set_name52 result['name'] = attribute_set.attribute_set_name
53 return result53 return result
54
55open_product_by_attribut_set()
5654
=== modified file 'magentoerpconnect_bundle/__openerp__.py'
--- magentoerpconnect_bundle/__openerp__.py 2012-03-15 09:47:04 +0000
+++ magentoerpconnect_bundle/__openerp__.py 2012-12-03 15:22:20 +0000
@@ -22,7 +22,7 @@
2222
23{23{
24 'name': 'magentoerpconnect_bundle',24 'name': 'magentoerpconnect_bundle',
25 'version': '0.1',25 'version': '6.1.0',
26 'category': 'Generic Modules',26 'category': 'Generic Modules',
27 'license': 'AGPL-3',27 'license': 'AGPL-3',
28 'description': """Module to extend the module magentoerpconnect, with it you will be able to create bundle product in magento directly from Openerp.28 'description': """Module to extend the module magentoerpconnect, with it you will be able to create bundle product in magento directly from Openerp.
@@ -41,9 +41,9 @@
41 'images/magentoerpconnect.png',41 'images/magentoerpconnect.png',
42 ],42 ],
43 "website" : "https://launchpad.net/magentoerpconnect",43 "website" : "https://launchpad.net/magentoerpconnect",
44 'depends': ['magentoerpconnect','sale_bundle_product'], 44 'depends': ['magentoerpconnect','sale_bundle_product'],
45 'init_xml': [],45 'init_xml': [],
46 'update_xml': [ 46 'update_xml': [
47 'sale_bundle_product_view.xml',47 'sale_bundle_product_view.xml',
48 'product_view.xml',48 'product_view.xml',
49 'settings/1.3.2.4/external.mappinglines.template.csv',49 'settings/1.3.2.4/external.mappinglines.template.csv',
5050
=== modified file 'magentoerpconnect_bundle/product.py'
--- magentoerpconnect_bundle/product.py 2012-03-28 09:49:00 +0000
+++ magentoerpconnect_bundle/product.py 2012-12-03 15:22:20 +0000
@@ -19,13 +19,11 @@
19# #19# #
20#################################################################################20#################################################################################
2121
22from osv import osv, fields22from openerp.osv.orm import Model
23import netsvc23
2424class product_product(Model):
25
26class product_product(osv.osv):
27 _inherit = "product.product"25 _inherit = "product.product"
28 26
29 def get_bundle_component(self, cr, uid, ids, context):27 def get_bundle_component(self, cr, uid, ids, context):
30 res = {}28 res = {}
31 for product in self.browse(cr, uid, ids, context=context):29 for product in self.browse(cr, uid, ids, context=context):
@@ -34,7 +32,7 @@
34 for product_item_set_line in product_item_set.item_set_line_ids:32 for product_item_set_line in product_item_set.item_set_line_ids:
35 res[product.id].append(product_item_set_line.product_id.id)33 res[product.id].append(product_item_set_line.product_id.id)
36 return res34 return res
37 35
38 def action_before_exporting(self, cr, uid, id, product_type, external_referential_ids, defaults, context=None):36 def action_before_exporting(self, cr, uid, id, product_type, external_referential_ids, defaults, context=None):
39 #When the export of a bundle product is forced we should check if all variant are already exported37 #When the export of a bundle product is forced we should check if all variant are already exported
40 if context.get('force_export', False) and product_type == 'bundle':38 if context.get('force_export', False) and product_type == 'bundle':
@@ -44,24 +42,19 @@
44 if not self.oeid_to_extid(cr, uid, id, shop.referential_id.id):42 if not self.oeid_to_extid(cr, uid, id, shop.referential_id.id):
45 self.ext_export(cr, uid, [id], external_referential_ids, defaults, context)43 self.ext_export(cr, uid, [id], external_referential_ids, defaults, context)
46 return super(product_product, self).action_before_exporting(cr, uid, id, product_type, external_referential_ids, defaults, context=context)44 return super(product_product, self).action_before_exporting(cr, uid, id, product_type, external_referential_ids, defaults, context=context)
47 45
4846
49 def add_data_to_create_bundle_product(self, cr, uid, oe_id, data, context=None):47 def add_data_to_create_bundle_product(self, cr, uid, oe_id, data, context=None):
50 shop = self.pool.get('sale.shop').browse(cr, uid, context['shop_id'])48 shop = self.pool.get('sale.shop').browse(cr, uid, context['shop_id'])
51 # check if not already created49 # check if not already created
52
53
54 #TODO add the data50 #TODO add the data
55 51 data.update({'configurable_products_data': products_data,
56 data.update({'configurable_products_data': products_data, 'configurable_attributes_data': attributes_data, 'associated_skus':associated_skus})52 'configurable_attributes_data': attributes_data,
53 'associated_skus':associated_skus})
57 return data54 return data
5855
59
60 def ext_create(self, cr, uid, data, conn, method, oe_id, context):56 def ext_create(self, cr, uid, data, conn, method, oe_id, context):
61 if data.get('type_id', False) == 'bundle':57 if data.get('type_id', False) == 'bundle':
62 data = self.add_data_to_create_bundle_product(cr, uid, oe_id, data, context)58 data = self.add_data_to_create_bundle_product(cr, uid, oe_id, data, context)
63 return super(product_product, self).ext_create(cr, uid, data, conn, method, oe_id, context)59 return super(product_product, self).ext_create(cr, uid, data, conn, method, oe_id, context)
64
65
66product_product()
6760
6861
=== modified file 'magentoerpconnect_bundle/product_view.xml'
--- magentoerpconnect_bundle/product_view.xml 2011-07-06 19:15:30 +0000
+++ magentoerpconnect_bundle/product_view.xml 2012-12-03 15:22:20 +0000
@@ -7,37 +7,37 @@
77
8<openerp>8<openerp>
9 <data>9 <data>
10 10
11 <!-- INHERITED VIEW FOR THE OBJECT : product_product 11 <!-- INHERITED VIEW FOR THE OBJECT : product_product
1212
13 <record id="product_view_form" model="ir.ui.view">13 <record id="product_view_form" model="ir.ui.view">
14 <field name="name">magentoerpconnect_bundle.product_product.view_form</field>14 <field name="name">magentoerpconnect_bundle.product_product.view_form</field>
15 <field name="model">product.product</field>15 <field name="model">product.product</field>
16 <field name="inherit_id" ref="module_name_to_inherit.view_id" />16 <field name="inherit_id" ref="module_name_to_inherit.view_id" />
17 <field eval="16" name="priority"/>17 <field eval="16" name="priority"/>
18 <field name="type">form</field>18 <field name="type">form</field>
19 <field name="arch" type="xml">19 <field name="arch" type="xml">
20 <data>20 <data>
21 <field name="field_reference" position="after">21 <field name="field_reference" position="after">
22 </field>22 </field>
23 </data>23 </data>
24 </field>24 </field>
25 </record>25 </record>
2626
27 <record id="product_view_tree" model="ir.ui.view">27 <record id="product_view_tree" model="ir.ui.view">
28 <field name="name">magentoerpconnect_bundle.product_product.view_tree</field>28 <field name="name">magentoerpconnect_bundle.product_product.view_tree</field>
29 <field name="model">product.product</field>29 <field name="model">product.product</field>
30 <field name="inherit_id" ref="module_name_to_inherit.view_id" />30 <field name="inherit_id" ref="module_name_to_inherit.view_id" />
31 <field eval="16" name="priority"/>31 <field eval="16" name="priority"/>
32 <field name="type">tree</field>32 <field name="type">tree</field>
33 <field name="arch" type="xml">33 <field name="arch" type="xml">
34 <data>34 <data>
35 <field name="field_reference" position="after">35 <field name="field_reference" position="after">
36 </field>36 </field>
37 </data>37 </data>
38 </field>38 </field>
39 </record>39 </record>
40 40
41-->41-->
4242
4343
4444
=== modified file 'magentoerpconnect_bundle/sale.py'
--- magentoerpconnect_bundle/sale.py 2012-03-15 09:47:04 +0000
+++ magentoerpconnect_bundle/sale.py 2012-12-03 15:22:20 +0000
@@ -19,10 +19,10 @@
19# #19# #
20#################################################################################20#################################################################################
2121
22from osv import osv22from openerp.osv.orm import Model
2323
2424
25class sale_order(osv.osv):25class sale_order(Model):
26 _inherit = "sale.order"26 _inherit = "sale.order"
2727
28 def _merge_sub_items(self, cr, uid, product_type, top_item, child_items, context=None):28 def _merge_sub_items(self, cr, uid, product_type, top_item, child_items, context=None):
@@ -37,5 +37,3 @@
37 else:37 else:
38 return super(sale_order, self)._merge_sub_items(cr, uid, product_type,38 return super(sale_order, self)._merge_sub_items(cr, uid, product_type,
39 top_item, child_items, context=context)39 top_item, child_items, context=context)
40
41sale_order()
4240
=== modified file 'magentoerpconnect_bundle/sale_bundle_product.py'
--- magentoerpconnect_bundle/sale_bundle_product.py 2011-10-30 20:09:37 +0000
+++ magentoerpconnect_bundle/sale_bundle_product.py 2012-12-03 15:22:20 +0000
@@ -19,24 +19,14 @@
19# #19# #
20#################################################################################20#################################################################################
2121
22from osv import osv, fields22from openerp.osv.orm import Model
23import netsvc23from openerp.osv import fields
2424
2525
26class product_item_set_line(osv.osv):26class product_item_set_line(Model):
27
28 _inherit = "product.item.set"27 _inherit = "product.item.set"
29
30
31 _columns = {28 _columns = {
32 'magento_render_type': fields.selection((('list','List'), ('c','Check Box')), 'Magento Render'),29 'magento_render_type': fields.selection((('list','List'), ('c','Check Box')), 'Magento Render'),
3330 }
34 }
35
36 _defaults = {
37
38 }
39
40product_item_set_line()
4131
4232
4333
=== modified file 'magentoerpconnect_bundle/sale_bundle_product_view.xml'
--- magentoerpconnect_bundle/sale_bundle_product_view.xml 2011-10-30 20:09:37 +0000
+++ magentoerpconnect_bundle/sale_bundle_product_view.xml 2012-12-03 15:22:20 +0000
@@ -7,23 +7,23 @@
77
8<openerp>8<openerp>
9 <data>9 <data>
10 10
11 <!-- INHERITED VIEW FOR THE OBJECT : product_item_set_line -->11 <!-- INHERITED VIEW FOR THE OBJECT : product_item_set_line -->
1212
13 <record id="product_item_set_view_form" model="ir.ui.view">13 <record id="product_item_set_view_form" model="ir.ui.view">
14 <field name="name">magentoerpconnect_bundle.product_item_set.view_form</field>14 <field name="name">magentoerpconnect_bundle.product_item_set.view_form</field>
15 <field name="model">product.item.set</field>15 <field name="model">product.item.set</field>
16 <field name="inherit_id" ref="sale_bundle_product.product_item_set_view_form" />16 <field name="inherit_id" ref="sale_bundle_product.product_item_set_view_form" />
17 <field eval="16" name="priority"/>17 <field eval="16" name="priority"/>
18 <field name="type">form</field>18 <field name="type">form</field>
19 <field name="arch" type="xml">19 <field name="arch" type="xml">
20 <data>20 <data>
21 <field name="required" position="after">21 <field name="required" position="after">
22 <field name="magento_render_type" />22 <field name="magento_render_type" />
23 </field>23 </field>
24 </data>24 </data>
25 </field>25 </field>
26 </record>26 </record>
2727
28 </data>28 </data>
29</openerp>29</openerp>
3030
=== modified file 'magentoerpconnect_bundle_split/__openerp__.py'
--- magentoerpconnect_bundle_split/__openerp__.py 2012-05-18 13:38:51 +0000
+++ magentoerpconnect_bundle_split/__openerp__.py 2012-12-03 15:22:20 +0000
@@ -21,7 +21,7 @@
2121
22{22{
23 'name': 'Magentoerpconnect Bundle Split',23 'name': 'Magentoerpconnect Bundle Split',
24 'version': '1.0',24 'version': '6.1.0',
25 'category': 'Generic Modules',25 'category': 'Generic Modules',
26 "author" : "Camptocamp",26 "author" : "Camptocamp",
27 'license': 'AGPL-3',27 'license': 'AGPL-3',
2828
=== modified file 'magentoerpconnect_bundle_split/sale.py'
--- magentoerpconnect_bundle_split/sale.py 2012-05-23 17:38:35 +0000
+++ magentoerpconnect_bundle_split/sale.py 2012-12-03 15:22:20 +0000
@@ -19,10 +19,11 @@
19#19#
20##############################################################################20##############################################################################
2121
22from osv import osv, fields22from openerp.osv.orm import Model
2323from openerp.osv import fields
2424
25class sale_order(osv.osv):25
26class sale_order(Model):
26 _inherit = "sale.order"27 _inherit = "sale.order"
2728
28 def _merge_sub_items(self, cr, uid, product_type, top_item, child_items, context=None):29 def _merge_sub_items(self, cr, uid, product_type, top_item, child_items, context=None):
@@ -47,15 +48,15 @@
47 else:48 else:
48 return super(sale_order, self)._merge_sub_items(cr, uid, product_type,49 return super(sale_order, self)._merge_sub_items(cr, uid, product_type,
49 top_item, child_items, context=context)50 top_item, child_items, context=context)
50 def oe_create(self, cr, uid, 51 def oe_create(self, cr, uid,
51 external_session, vals, resource, defaults, context):52 external_session, vals, resource, defaults, context):
5253
53 order_id = super(sale_order, self).\54 order_id = super(sale_order, self).\
54 oe_create(cr, uid, external_session,55 oe_create(cr, uid, external_session,
55 vals, 56 vals,
56 resource, 57 resource,
57 defaults=defaults, 58 defaults=defaults,
58 context=context)59 context=context)
5960
60 order_line_obj = self.pool.get('sale.order.line')61 order_line_obj = self.pool.get('sale.order.line')
61 order = self.browse(cr, uid, order_id, context=context)62 order = self.browse(cr, uid, order_id, context=context)
@@ -86,17 +87,11 @@
86 res['sale_line_bundle_id'] = line.bundle_parent_id.id87 res['sale_line_bundle_id'] = line.bundle_parent_id.id
87 return res88 return res
8889
89sale_order()90
9091class sale_order_line(Model):
91
92class sale_order_line(osv.osv):
93
94 _inherit = 'sale.order.line'92 _inherit = 'sale.order.line'
95
96 _columns = {93 _columns = {
97 'bundle_parent_id': fields.many2one('sale.order.line', 'Bundle Line'),94 'bundle_parent_id': fields.many2one('sale.order.line', 'Bundle Line'),
98 'magento_item_id': fields.integer('Magento Item ID'),95 'magento_item_id': fields.integer('Magento Item ID'),
99 'magento_parent_item_id': fields.integer('Magento Item ID'),96 'magento_parent_item_id': fields.integer('Magento Item ID'),
100 }97 }
101
102sale_order_line()
10398
=== modified file 'magentoerpconnect_bundle_split/stock.py'
--- magentoerpconnect_bundle_split/stock.py 2012-05-23 17:38:35 +0000
+++ magentoerpconnect_bundle_split/stock.py 2012-12-03 15:22:20 +0000
@@ -19,11 +19,11 @@
19#19#
20##############################################################################20##############################################################################
2121
22from osv import osv, fields22from openerp.osv.orm import Model
2323from openerp.osv import fields
2424
25class stock_picking(osv.osv):25
2626class stock_picking(Model):
27 _inherit = 'stock.picking'27 _inherit = 'stock.picking'
2828
29 def create_ext_shipping(self, cr, uid, id, picking_type,29 def create_ext_shipping(self, cr, uid, id, picking_type,
@@ -56,16 +56,10 @@
56 cr, uid, id, picking_type,56 cr, uid, id, picking_type,
57 external_referential_id, context)57 external_referential_id, context)
5858
59stock_picking()59
6060class stock_move(Model):
61
62class stock_move(osv.osv):
63
64 _inherit = 'stock.move'61 _inherit = 'stock.move'
65
66 _columns = {62 _columns = {
67 'sale_line_bundle_id': fields.many2one('sale.order.line',63 'sale_line_bundle_id': fields.many2one('sale.order.line',
68 string='Sale Order Line Bundle')64 string='Sale Order Line Bundle')
69 }65 }
70
71stock_move()
7266
=== renamed directory 'magentoerpconnect_partner_fiscal_category' => 'magentoerpconnect_customer_fiscal_category'
=== modified file 'magentoerpconnect_customer_fiscal_category/__openerp__.py'
--- magentoerpconnect_partner_fiscal_category/__openerp__.py 2012-03-27 09:51:08 +0000
+++ magentoerpconnect_customer_fiscal_category/__openerp__.py 2012-12-03 15:22:20 +0000
@@ -21,7 +21,7 @@
2121
22{22{
23 'name': 'Magentoerpconnect Partner Fiscal Category',23 'name': 'Magentoerpconnect Partner Fiscal Category',
24 'version': '1.0',24 'version': '6.1.0',
25 'category': 'Generic Modules',25 'category': 'Generic Modules',
26 "author" : "Camptocamp",26 "author" : "Camptocamp",
27 'license': 'AGPL-3',27 'license': 'AGPL-3',
@@ -46,7 +46,7 @@
46 'depends': ['magentoerpconnect',46 'depends': ['magentoerpconnect',
47 'account_fiscal_rules_partner_category', ],47 'account_fiscal_rules_partner_category', ],
48 'init_xml': [],48 'init_xml': [],
49 'update_xml': ['settings/1.3.2.4/external.mappinglines.template.csv',49 'update_xml': [#'settings/1.3.2.4/external.mappinglines.template.csv',
50 'settings/1.5.0.0/external.mappinglines.template.csv', ],50 'settings/1.5.0.0/external.mappinglines.template.csv', ],
51 'demo_xml': [],51 'demo_xml': [],
52 'installable': True,52 'installable': True,
5353
=== modified file 'magentoerpconnect_customer_fiscal_category/settings/1.5.0.0/external.mappinglines.template.csv'
--- magentoerpconnect_partner_fiscal_category/settings/1.5.0.0/external.mappinglines.template.csv 2012-05-09 12:54:07 +0000
+++ magentoerpconnect_customer_fiscal_category/settings/1.5.0.0/external.mappinglines.template.csv 2012-12-03 15:22:20 +0000
@@ -1,7 +1,2 @@
1id,type_id:id,model_id:id,external_field,field_id:id,type,evaluation_type,external_type,child_mapping_id:id,in_function,out_function1id,sequence,type,evaluation_type,external_field,field_id:id,external_type,alternative_key,mapping_id:id,function_name,in_function,out_function,child_mapping_id:id,datetime_format
2magento_1500_prt_tax_class_id,magentoerpconnect.magento1500,base.model_res_partner,tax_class_id,,in_out,function,int,,"result = [('fiscal_category_id', False)]2mag1500_res_partner_group_id,,in_out,direct,group_id,account_fiscal_rules_partner_category.field_res_partner_fiscal_category_id,int,False,magentoerpconnect.mag1500_res_partner,,,,,
3if ifield:
4 category_obj = self.pool.get('res.partner.category')
5 category_ids = category_obj.search(cr, uid, [('tax_class_id', '=', ifield)])
6 if category_ids:
7 result = [('fiscal_category_id', category_ids[0])]",
83
=== modified file 'magentoerpconnect_init_stock/__openerp__.py'
--- magentoerpconnect_init_stock/__openerp__.py 2012-03-21 11:09:29 +0000
+++ magentoerpconnect_init_stock/__openerp__.py 2012-12-03 15:22:20 +0000
@@ -20,7 +20,7 @@
20##############################################################################20##############################################################################
2121
22{'name' : 'Magentoerpconnect Initialize Stock',22{'name' : 'Magentoerpconnect Initialize Stock',
23 'version' : '1.0',23 'version' : '6.1.0',
24 'author' : 'Camptocamp',24 'author' : 'Camptocamp',
25 'maintainer': 'Camptocamp',25 'maintainer': 'Camptocamp',
26 'license': 'AGPL-3',26 'license': 'AGPL-3',
2727
=== modified file 'magentoerpconnect_init_stock/product.py'
--- magentoerpconnect_init_stock/product.py 2012-03-21 11:09:29 +0000
+++ magentoerpconnect_init_stock/product.py 2012-12-03 15:22:20 +0000
@@ -20,12 +20,11 @@
20##############################################################################20##############################################################################
2121
22import logging22import logging
23from osv import osv23from openerp.osv.orm import Model
2424
25_logger = logging.getLogger(__name__)25_logger = logging.getLogger(__name__)
2626
2727class product_product(Model):
28class product_product(osv.osv):
2928
30 _inherit = 'product.product'29 _inherit = 'product.product'
3130
@@ -52,5 +51,3 @@
52 self._magento_init_stock(cr, uid, oe_id, magento_product_id,51 self._magento_init_stock(cr, uid, oe_id, magento_product_id,
53 conn, context=context)52 conn, context=context)
54 return magento_product_id53 return magento_product_id
55
56product_product()
5754
=== added directory 'magentoerpconnect_magento_invoice'
=== added file 'magentoerpconnect_magento_invoice/__init__.py'
--- magentoerpconnect_magento_invoice/__init__.py 1970-01-01 00:00:00 +0000
+++ magentoerpconnect_magento_invoice/__init__.py 2012-12-03 15:22:20 +0000
@@ -0,0 +1,28 @@
1# -*- encoding: utf-8 -*-
2###############################################################################
3#
4# magentoerpconnect_magento_invoice for OpenERP
5# Copyright (C) 2012-TODAY Akretion <http://www.akretion.com>. All Rights Reserved
6# @author Sébastien BEAU <sebastien.beau@akretion.com>
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20###############################################################################
21
22
23
24import account
25
26
27
28
029
=== added file 'magentoerpconnect_magento_invoice/__openerp__.py'
--- magentoerpconnect_magento_invoice/__openerp__.py 1970-01-01 00:00:00 +0000
+++ magentoerpconnect_magento_invoice/__openerp__.py 2012-12-03 15:22:20 +0000
@@ -0,0 +1,44 @@
1# -*- encoding: utf-8 -*-
2###############################################################################
3#
4# magentoerpconnect_magento_invoice for OpenERP
5# Copyright (C) 2012-TODAY Akretion <http://www.akretion.com>. All Rights Reserved
6# @author Sébastien BEAU <sebastien.beau@akretion.com>
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20###############################################################################
21
22
23
24
25{
26 'name': 'magentoerpconnect_magento_invoice',
27 'version': '6.1.1',
28 'category': 'Generic Modules',
29 'license': 'AGPL-3',
30 'description': """This module will use the Magento invoice number for the OpenERP Invoice.
31 Be carefull if your Magento is not available you can not validade an invoice in OpenERP
32 TODO refactor MagentoERPconnect in order to extract the other way to synchronise order
33 """,
34 'author': 'Akretion',
35 'website': 'http://www.akretion.com/',
36 'depends': ['magentoerpconnect'],
37 'init_xml': [],
38 'update_xml': [
39 ],
40 'demo_xml': [],
41 'installable': True,
42 'active': False,
43}
44
045
=== added file 'magentoerpconnect_magento_invoice/account.py'
--- magentoerpconnect_magento_invoice/account.py 1970-01-01 00:00:00 +0000
+++ magentoerpconnect_magento_invoice/account.py 2012-12-03 15:22:20 +0000
@@ -0,0 +1,35 @@
1# -*- encoding: utf-8 -*-
2###############################################################################
3#
4# magentoerpconnect_magento_invoice for OpenERP
5# Copyright (C) 2012-TODAY Akretion <http://www.akretion.com>. All Rights Reserved
6# @author Sébastien BEAU <sebastien.beau@akretion.com>
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20###############################################################################
21
22
23from openerp.osv.orm import Model
24
25class account_invoice(Model):
26 _inherit = "account.invoice"
27
28 def action_move_create(self, cr, uid, ids, context=None):
29 if context is None:
30 context = {'lang': 'en_US'}
31 for invoice in self.browse(cr, uid, ids, context=context):
32 ext_invoice_id = self._export_one_invoice(cr, uid, invoice, context=context)
33 invoice.write({'internal_number': ext_invoice_id}, context=context)
34 return super(account_invoice, self).action_move_create(cr, uid, ids, context=context)
35
036
=== renamed directory 'magentoerpconnect_report_synchronizer' => 'magentoerpconnect_openerp_invoice'
=== modified file 'magentoerpconnect_openerp_invoice/__init__.py'
--- magentoerpconnect_report_synchronizer/__init__.py 2012-06-01 17:48:36 +0000
+++ magentoerpconnect_openerp_invoice/__init__.py 2012-12-03 15:22:20 +0000
@@ -20,9 +20,5 @@
20###############################################################################20###############################################################################
2121
2222
23
24import invoice23import invoice
2524import external_referential
26
27
28
2925
=== modified file 'magentoerpconnect_openerp_invoice/__openerp__.py'
--- magentoerpconnect_report_synchronizer/__openerp__.py 2012-06-01 17:48:36 +0000
+++ magentoerpconnect_openerp_invoice/__openerp__.py 2012-12-03 15:22:20 +0000
@@ -1,7 +1,7 @@
1# -*- encoding: utf-8 -*-1# -*- encoding: utf-8 -*-
2###############################################################################2###############################################################################
3# #3# #
4# magentoerpconnect_report_synchronizer for OpenERP #4# magentoerpconnect_openerp_invoice for OpenERP #
5# Copyright (C) 2012 Akretion Sébastien BEAU <sebastien.beau@akretion.com> #5# Copyright (C) 2012 Akretion Sébastien BEAU <sebastien.beau@akretion.com> #
6# #6# #
7# This program is free software: you can redistribute it and/or modify #7# This program is free software: you can redistribute it and/or modify #
@@ -22,8 +22,8 @@
2222
2323
24{24{
25 'name': 'magentoerpconnect_report_synchronizer',25 'name': 'magentoerpconnect_openerp_invoice',
26 'version': '0.1',26 'version': '6.1.1',
27 'category': 'Generic Modules/Others',27 'category': 'Generic Modules/Others',
28 'license': 'AGPL-3',28 'license': 'AGPL-3',
29 'description': """29 'description': """
@@ -32,9 +32,13 @@
32 """,32 """,
33 'author': 'Akretion',33 'author': 'Akretion',
34 'website': 'http://www.akretion.com/',34 'website': 'http://www.akretion.com/',
35 'depends': ['base_sale_report_synchronizer'], 35 'depends': [
36 'base_sale_report_synchronizer',
37 'magentoerpconnect',
38 ],
36 'init_xml': [],39 'init_xml': [],
37 'update_xml': [ 40 'update_xml': [
41 'external_referential_view.xml',
38 ],42 ],
39 'demo_xml': [],43 'demo_xml': [],
40 'installable': True,44 'installable': True,
4145
=== added file 'magentoerpconnect_openerp_invoice/external_referential.py'
--- magentoerpconnect_openerp_invoice/external_referential.py 1970-01-01 00:00:00 +0000
+++ magentoerpconnect_openerp_invoice/external_referential.py 2012-12-03 15:22:20 +0000
@@ -0,0 +1,33 @@
1# -*- encoding: utf-8 -*-
2###############################################################################
3# #
4# base_sale_report_synchronizer for OpenERP #
5# Copyright (C) 2012 Akretion Sébastien BEAU <sebastien.beau@akretion.com> #
6# #
7# This program is free software: you can redistribute it and/or modify #
8# it under the terms of the GNU Affero General Public License as #
9# published by the Free Software Foundation, either version 3 of the #
10# License, or (at your option) any later version. #
11# #
12# This program is distributed in the hope that it will be useful, #
13# but WITHOUT ANY WARRANTY; without even the implied warranty of #
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15# GNU Affero General Public License for more details. #
16# #
17# You should have received a copy of the GNU Affero General Public License #
18# along with this program. If not, see <http://www.gnu.org/licenses/>. #
19# #
20###############################################################################
21
22from openerp.osv.orm import Model
23from openerp.osv import fields
24import netsvc
25
26class external_referential(Model):
27 _inherit = "external.referential"
28
29 _columns = {
30 'ext_file_referential_id': fields.many2one('external.referential', 'External Referential File',
31 help='Referential file where the OpenERP report will be push'),
32 }
33
034
=== added file 'magentoerpconnect_openerp_invoice/external_referential_view.xml'
--- magentoerpconnect_openerp_invoice/external_referential_view.xml 1970-01-01 00:00:00 +0000
+++ magentoerpconnect_openerp_invoice/external_referential_view.xml 2012-12-03 15:22:20 +0000
@@ -0,0 +1,22 @@
1<?xml version="1.0" encoding="utf-8"?>
2<!--
3 base_sale_report_synchronizer for OpenERP
4 Copyright (C) 2012 Akretion Sébastien BEAU <sebastien.beau@akretion.com>
5 The licence is in the file __openerp__.py
6-->
7
8<openerp>
9 <data>
10 <record id="external_referential_form_view" model="ir.ui.view">
11 <field name="name">base_sale_report_synchronizer.external_referential_form_view</field>
12 <field name="model">external.referential</field>
13 <field name="inherit_id" ref="base_external_referentials.external_referential_form_view" />
14 <field name="type">form</field>
15 <field name="arch" type="xml">
16 <field name="location" position="after">
17 <field name="ext_file_referential_id"/>
18 </field>
19 </field>
20 </record>
21 </data>
22</openerp>
023
=== modified file 'magentoerpconnect_openerp_invoice/invoice.py'
--- magentoerpconnect_report_synchronizer/invoice.py 2012-06-01 17:48:36 +0000
+++ magentoerpconnect_openerp_invoice/invoice.py 2012-12-03 15:22:20 +0000
@@ -19,30 +19,63 @@
19# #19# #
20###############################################################################20###############################################################################
2121
22from osv import osv, fields22from openerp.osv.orm import Model
23from tools.translate import _23from openerp.osv import fields
24from base_external_referentials.external_osv import ExternalSession
25import os
2426
25class account_invoice(osv.osv):27class account_invoice(Model):
26 _inherit = "account.invoice"28 _inherit = "account.invoice"
2729
28 def ext_create(self, cr, uid, external_session, resources, mapping=None, mapping_id=None, context=None):30 def _export_one_resource(self, cr, uid, external_session, invoice_id, context=None):
29 ext_create_ids={}31 #TODO think about a better solution to pass the report_name
30 for resource_id, resource in resources.items():32 context['report_name'] = self._send_invoice_report(cr, uid, external_session,
31 resource = resource[resource.keys()[0]]33 invoice_id, context=context)
32 if resource['type'] == 'out_refund':34 return super(account_invoice, self)._export_one_resource(cr, uid, external_session,
33 method = "synoopenerpadapter_creditmemo.addInfo"35 invoice_id, context=context)
34 elif resource['type'] == 'out_invoice':36
35 method = "synoopenerpadapter_invoice.addInfo"37 def _send_invoice_report(self, cr, uid, external_session, invoice_id, context=None):
36 resource['reference'] = context.get('report_name')38 invoice = self.browse(cr, uid, invoice_id, context=context)
37 ext_create_ids[resource_id] = external_session.connection.call(method, 39 invoice_number = invoice.number.replace('/', '-')
38 [40 invoice_path = self._get_invoice_path(cr, uid, external_session, invoice, context=context)
39 resource['customer_id'],41 if not external_session.sync_from_object.invoice_report:
40 resource['order_increment_id'],42 raise except_osv(_("User Error"), _("You must define a report for the invoice for your sale shop"))
41 resource['reference'],43 report_name = "report.%s"%external_session.sync_from_object.invoice_report.report_name
42 resource['amount'],44 #Init the connection with the sftp/ftp/... referential
43 resource['date'],45 if not hasattr(external_session, 'file_session'):
44 resource['customer_name'],46 external_session.file_session = ExternalSession(
45 ])47 external_session.referential_id.ext_file_referential_id,
46 super(account_invoice, self).ext_create(cr, uid, external_session, resources, 48 external_session.sync_from_object,
47 mapping=mapping, mapping_id=mapping_id, context=context)49 )
48 return ext_create_ids 50 return self.send_report(cr, uid, external_session.file_session, [invoice.id], report_name,
51 invoice_number, invoice_path, add_extension=False, context=context)
52
53 def _get_invoice_path(self, cr, uid, external_session, invoice, context=None):
54 ref_id = external_session.referential_id.id
55 ext_partner_id = invoice.partner_id.get_extid(ref_id, context=context)
56 ext_sale_id = invoice.sale_ids[0].get_extid(ref_id, context=context)
57 if invoice.type == 'out_invoice':
58 basepath = 'invoice'
59 elif invoice.type == 'out_refund':
60 basepath = 'creditmemo'
61 return os.path.join(basepath, str(ext_partner_id), str(ext_sale_id))
62
63 def ext_create_one_invoice(self, cr, uid, external_session, resource_id, resource, context=None):
64 data = resource[resource.keys()[0]]
65 if data['type'] == 'out_refund':
66 method = "synoopenerpadapter_creditmemo.addInfo"
67 elif data['type'] == 'out_invoice':
68 method = "synoopenerpadapter_invoice.addInfo"
69 data['reference'] = context.get('report_name')
70 res = external_session.connection.call(method,
71 [
72 data['customer_id'],
73 data['order_increment_id'],
74 data['reference'],
75 data['amount'],
76 data['date'],
77 data['customer_name'],
78 ])
79 super(account_invoice, self).ext_create_one_invoice(cr, uid, external_session,
80 resource_id, resource, context=context)
81 return res
4982
=== added directory 'magentoerpconnect_partner_surname'
=== added file 'magentoerpconnect_partner_surname/__init__.py'
--- magentoerpconnect_partner_surname/__init__.py 1970-01-01 00:00:00 +0000
+++ magentoerpconnect_partner_surname/__init__.py 2012-12-03 15:22:20 +0000
@@ -0,0 +1,21 @@
1# -*- encoding: utf-8 -*-
2###############################################################################
3#
4# magentoerpconnect_partner_surname for OpenERP
5# Copyright (C) 2012-TODAY Akretion <http://www.akretion.com>.
6# All Rights Reserved
7# @author Sébastien BEAU <sebastien.beau@akretion.com>
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21###############################################################################
022
=== added file 'magentoerpconnect_partner_surname/__openerp__.py'
--- magentoerpconnect_partner_surname/__openerp__.py 1970-01-01 00:00:00 +0000
+++ magentoerpconnect_partner_surname/__openerp__.py 2012-12-03 15:22:20 +0000
@@ -0,0 +1,43 @@
1# -*- encoding: utf-8 -*-
2###############################################################################
3#
4# magentoerpconnect_partner_surname for OpenERP
5# Copyright (C) 2012-TODAY Akretion <http://www.akretion.com>.
6# All Rights Reserved
7# @author Sébastien BEAU <sebastien.beau@akretion.com>
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21###############################################################################
22
23{
24 'name': 'magentoerpconnect_partner_surname',
25 'version': '6.1.0',
26 'category': 'Generic Modules/Others',
27 'license': 'AGPL-3',
28 'description': """
29 This module with the dependency base_partner_surname add the
30 posibility to manage the fistname and the last name in a separated field
31 instead of having only one field 'name'
32 """,
33 'author': 'Akretion',
34 'website': 'http://www.akretion.com/',
35 'depends': ['magentoerpconnect', 'base_partner_surname'],
36 'init_xml': [],
37 'update_xml': [
38 'settings/1.5.0.0/res.partner.address/external.mappinglines.template.csv',
39 ],
40 'demo_xml': [],
41 'installable': True,
42 'auto_install': True,
43}
044
=== added directory 'magentoerpconnect_partner_surname/settings'
=== added directory 'magentoerpconnect_partner_surname/settings/1.5.0.0'
=== added directory 'magentoerpconnect_partner_surname/settings/1.5.0.0/res.partner.address'
=== added file 'magentoerpconnect_partner_surname/settings/1.5.0.0/res.partner.address/external.mappinglines.template.csv'
--- magentoerpconnect_partner_surname/settings/1.5.0.0/res.partner.address/external.mappinglines.template.csv 1970-01-01 00:00:00 +0000
+++ magentoerpconnect_partner_surname/settings/1.5.0.0/res.partner.address/external.mappinglines.template.csv 2012-12-03 15:22:20 +0000
@@ -0,0 +1,3 @@
1id,sequence,type,evaluation_type,external_field,field_id:id,external_type,alternative_key,mapping_id:id,function_name,in_function,out_function,child_mapping_id:id,datetime_format
2magentoerpconnect.mag1500_res_partner_address_name,,in_out,direct,firstname,base_partner_surname.field_res_partner_address_first_name,unicode,True,magentoerpconnect.mag1500_res_partner_address,,,,,
3mag1500_res_partner_address_lastname,,in_out,direct,lastname,base_partner_surname.field_res_partner_address_last_name,unicode,True,magentoerpconnect.mag1500_res_partner_address,,,,,
04
=== modified file 'magentoerpconnect_payment/__openerp__.py'
--- magentoerpconnect_payment/__openerp__.py 2012-03-27 09:40:33 +0000
+++ magentoerpconnect_payment/__openerp__.py 2012-12-03 15:22:20 +0000
@@ -21,7 +21,7 @@
2121
2222
23{'name': 'Magentoerpconnect Payment',23{'name': 'Magentoerpconnect Payment',
24 'version': '1.0',24 'version': '6.1.0',
25 'category': 'Generic Modules',25 'category': 'Generic Modules',
26 'author': "Camptocamp",26 'author': "Camptocamp",
27 'license': 'AGPL-3',27 'license': 'AGPL-3',
2828
=== modified file 'magentoerpconnect_payment/payment_type.py'
--- magentoerpconnect_payment/payment_type.py 2012-03-27 09:40:33 +0000
+++ magentoerpconnect_payment/payment_type.py 2012-12-03 15:22:20 +0000
@@ -19,16 +19,14 @@
19#19#
20##############################################################################20##############################################################################
2121
22from osv import osv, fields22from openerp.osv.orm import Model
2323from openerp.osv import fields
2424
25class base_sale_payment_type(osv.osv):25
2626class base_sale_payment_type(Model):
27 _inherit = 'base.sale.payment.type'27 _inherit = 'base.sale.payment.type'
28
29 _columns = {28 _columns = {
30 'allow_magento_manual_invoice':29 'allow_magento_manual_invoice':
31 fields.boolean('Allow Manual Creation of Magento Invoice')30 fields.boolean('Allow Manual Creation of Magento Invoice')
32 }31 }
3332
34base_sale_payment_type()
3533
=== modified file 'magentoerpconnect_payment/sale.py'
--- magentoerpconnect_payment/sale.py 2012-03-27 09:40:33 +0000
+++ magentoerpconnect_payment/sale.py 2012-12-03 15:22:20 +0000
@@ -20,11 +20,13 @@
20##############################################################################20##############################################################################
21import xmlrpclib21import xmlrpclib
2222
23from osv import osv, fields23from openerp.osv.orm import Model
24from openerp.osv import fields
25from openerp.osv.osv import except_osv
24from tools.translate import _26from tools.translate import _
2527
2628
27class sale_order(osv.osv):29class sale_order(Model):
2830
29 _inherit = 'sale.order'31 _inherit = 'sale.order'
3032
@@ -52,10 +54,9 @@
52 # TODO: in case of error on Magento because the invoice has54 # TODO: in case of error on Magento because the invoice has
53 # already been created, get the invoice number55 # already been created, get the invoice number
54 # and store it in magento_ref56 # and store it in magento_ref
55 raise osv.except_osv(57 raise except_osv(_('Error'),
56 _('Error'), _("Error on Magento on the invoice creation "58 _("Error on Magento on the invoice creation "
57 "for order %s :\n" \59 "for order %s :\n%s") % (order.name, magento_error))
58 "%s" % (order.name, magento_error)))
59 self.write(60 self.write(
60 cr, uid, order.id,61 cr, uid, order.id,
61 {'magento_ref': external_invoice},62 {'magento_ref': external_invoice},
@@ -69,24 +70,23 @@
69 def button_magento_create_invoice(self, cr, uid, ids, context=None):70 def button_magento_create_invoice(self, cr, uid, ids, context=None):
70 order = self.browse(cr, uid, ids[0], context=context)71 order = self.browse(cr, uid, ids[0], context=context)
71 if order.state != 'draft':72 if order.state != 'draft':
72 raise osv.except_osv(73 raise except_osv(_('Error'),
73 _('Error'), _('This order is not a quotation.'))74 _('This order is not a quotation.'))
7475
75 if not order.is_magento:76 if not order.is_magento:
76 raise osv.except_osv(77 raise except_osv(_('Error'),
77 _('Error'), _('This is not a Magento sale order.'))78 _('This is not a Magento sale order.'))
7879
79 if not order.base_payment_type_id:80 if not order.base_payment_type_id:
80 raise osv.except_osv(81 raise except_osv(_('Error'),
81 _('Error'), _('This order has no external '82 _('This order has no external '
82 'payment type settings.'))83 'payment type settings.'))
8384
84 if not order.base_payment_type_id.allow_magento_manual_invoice:85 if not order.base_payment_type_id.allow_magento_manual_invoice:
85 raise osv.except_osv(86 raise except_osv(_('Error'),
86 _('Error'), _(87 _("Manual creation of the invoice on Magento "
87 "Manual creation of the invoice on Magento "88 "is forbidden for external payment : %s") %
88 "is forbidden for external payment : %s" %89 order.ext_payment_method)
89 order.ext_payment_method))
9090
91 # sale_exceptions module methods91 # sale_exceptions module methods
92 # in order to check if the order is valid92 # in order to check if the order is valid
@@ -122,5 +122,3 @@
122 if order.magento_ref:122 if order.magento_ref:
123 vals['magento_ref'] = order.magento_ref123 vals['magento_ref'] = order.magento_ref
124 return vals124 return vals
125
126sale_order()
127125
=== modified file 'magentoerpconnect_product_variant/__openerp__.py'
--- magentoerpconnect_product_variant/__openerp__.py 2012-04-24 12:36:18 +0000
+++ magentoerpconnect_product_variant/__openerp__.py 2012-12-03 15:22:20 +0000
@@ -22,7 +22,7 @@
2222
23{23{
24 'name': 'magentoerpconnect_configurable_product',24 'name': 'magentoerpconnect_configurable_product',
25 'version': '0.1',25 'version': '6.1.0',
26 'category': 'Generic Modules',26 'category': 'Generic Modules',
27 'license': 'AGPL-3',27 'license': 'AGPL-3',
28 'description': """Module to extend the module magentoerpconnect, with it you will be able to create variant of product in magento directly from Openerp. Enjoy it !28 'description': """Module to extend the module magentoerpconnect, with it you will be able to create variant of product in magento directly from Openerp. Enjoy it !
@@ -36,9 +36,9 @@
36 'images/magentoerpconnect.png',36 'images/magentoerpconnect.png',
37 ],37 ],
38 "website" : "https://launchpad.net/magentoerpconnect",38 "website" : "https://launchpad.net/magentoerpconnect",
39 'depends': ['magentoerpconnect', 'product_variant_multi'], 39 'depends': ['magentoerpconnect', 'product_variant_multi'],
40 'init_xml': [],40 'init_xml': [],
41 'update_xml': [ 41 'update_xml': [
42 'product_view.xml',42 'product_view.xml',
43# 'settings/1.3.2.4/external.mappinglines.template.csv',43# 'settings/1.3.2.4/external.mappinglines.template.csv',
44 'settings/1.5.0.0/external.mappinglines.template.csv',44 'settings/1.5.0.0/external.mappinglines.template.csv',
4545
=== modified file 'magentoerpconnect_product_variant/product.py'
--- magentoerpconnect_product_variant/product.py 2012-08-20 21:52:00 +0000
+++ magentoerpconnect_product_variant/product.py 2012-12-03 15:22:20 +0000
@@ -19,42 +19,30 @@
19# #19# #
20#################################################################################20#################################################################################
2121
22from osv import osv, fields22from openerp.osv.orm import Model
23from openerp.osv import fields
23import netsvc24import netsvc
2425
25class product_variant_dimension_type(osv.osv):26class product_variant_dimension_type(Model):
26
27 _inherit = "product.variant.dimension.type"27 _inherit = "product.variant.dimension.type"
28
29
30 _columns = {28 _columns = {
31 'magento_attribut': fields.many2one('magerp.product_attributes', 'magento_attributs', domain = "[('frontend_input', '=', 'select'), ('is_global', '=', True), ('is_configurable', '=', True)]"),29 'magento_attribut': fields.many2one('magerp.product_attributes', 'magento_attributs',
32 }30 domain="[('frontend_input', '=', 'select'), ('is_global', '=', True), ('is_configurable', '=', True)]"),
3331 }
34product_variant_dimension_type()32
3533
3634class product_variant_dimension_option(Model):
37class product_variant_dimension_option(osv.osv):
38
39 _inherit = "product.variant.dimension.option"35 _inherit = "product.variant.dimension.option"
40
41
42 _columns = {36 _columns = {
43 #'magento_attribut': fields.related('dimension_id', 'magento_attribut', type="many2one", relation="magerp.product_attributes", string="Magento attributs", readonly=True),37 'magento_attribut_option': fields.many2one('magerp.product_attribute_options', 'magento_attributs_option',
44 'magento_attribut_option': fields.many2one('magerp.product_attribute_options', 'magento_attributs_option', domain = "[('attribute_id', '=', parent.magento_attribut)]"),38 domain="[('attribute_id', '=', parent.magento_attribut)]"),
4539 }
46 }40
4741
4842class product_product(Model):
49product_variant_dimension_option()
50
51class product_product(osv.osv):
52
53 _inherit = "product.product"43 _inherit = "product.product"
5444
5545 #TODO for update A configurable product have to be updated if a variant is added
56#TODO for update A configurable product have to be updated if a variant is added
57
58 def build_product_code_and_properties(self, cr, uid, ids, context=None):46 def build_product_code_and_properties(self, cr, uid, ids, context=None):
59 super(product_product, self).build_product_code_and_properties(cr, uid, ids, context=context)47 super(product_product, self).build_product_code_and_properties(cr, uid, ids, context=context)
60 magento_product_exportable_ids = []48 magento_product_exportable_ids = []
@@ -68,7 +56,7 @@
68# vals['x_magerp_visibility'] = option_id56# vals['x_magerp_visibility'] = option_id
69 self.write(cr, uid, magento_product_exportable_ids, vals, context=context)57 self.write(cr, uid, magento_product_exportable_ids, vals, context=context)
70 return True58 return True
71 59
72 def generate_variant_name(self, cr, uid, product_id, context=None):60 def generate_variant_name(self, cr, uid, product_id, context=None):
73 res = super(product_product, self).generate_variant_name(cr, uid, product_id, context)61 res = super(product_product, self).generate_variant_name(cr, uid, product_id, context)
74 if res == '':62 if res == '':
@@ -86,7 +74,7 @@
86 else:74 else:
87 vals['product_type'] = 'simple'75 vals['product_type'] = 'simple'
88 return super(product_product, self).create(cr, uid, vals, context)76 return super(product_product, self).create(cr, uid, vals, context)
89 77
90 def _filter_fields_to_return(self, cr, uid, field_names, context):78 def _filter_fields_to_return(self, cr, uid, field_names, context):
91 #In the cas that the magento view is open from the button 'open magento fields', we can give a very customize view because only on for one product79 #In the cas that the magento view is open from the button 'open magento fields', we can give a very customize view because only on for one product
92 field_names = super(product_product, self)._filter_fields_to_return(cr, uid, field_names, context)80 field_names = super(product_product, self)._filter_fields_to_return(cr, uid, field_names, context)
@@ -145,15 +133,11 @@
145 return ext_update_ids133 return ext_update_ids
146134
147135
148product_product()136class product_template(Model):
149
150class product_template(osv.osv):
151
152 _inherit = "product.template"137 _inherit = "product.template"
153
154 _columns = {138 _columns = {
155 'magento_exportable':fields.boolean('Exported all variant to Magento?'),139 'magento_exportable':fields.boolean('Exported all variant to Magento?'),
156 }140 }
157141
158142
159 #TODO improve me, it will be great to have the posibility to create various configurable per template143 #TODO improve me, it will be great to have the posibility to create various configurable per template
@@ -162,7 +146,5 @@
162 res = res + [[]]146 res = res + [[]]
163 return res147 return res
164148
165product_template()
166
167149
168150
169151
=== modified file 'magentoerpconnect_product_variant/product_view.xml'
--- magentoerpconnect_product_variant/product_view.xml 2012-05-23 14:01:19 +0000
+++ magentoerpconnect_product_variant/product_view.xml 2012-12-03 15:22:20 +0000
@@ -7,88 +7,88 @@
77
8<openerp>8<openerp>
9 <data>9 <data>
10 10
11 <!-- INHERITED VIEW FOR THE OBJECT : product_variant_dimension_option -->11 <!-- INHERITED VIEW FOR THE OBJECT : product_variant_dimension_option -->
1212
13 <record id="magentoerpconnect_cp_product_variant_dimension_option_view_form" model="ir.ui.view">13 <record id="magentoerpconnect_cp_product_variant_dimension_option_view_form" model="ir.ui.view">
14 <field name="name">magentoerpconnect_cp.product_variant_dimension_option.view_form</field>14 <field name="name">magentoerpconnect_cp.product_variant_dimension_option.view_form</field>
15 <field name="model">product.variant.dimension.option</field>15 <field name="model">product.variant.dimension.option</field>
16 <field name="inherit_id" ref="product_variant_multi.product_variant_multi_dimension_option_form" />16 <field name="inherit_id" ref="product_variant_multi.product_variant_multi_dimension_option_form" />
17 <field eval="16" name="priority"/>17 <field eval="16" name="priority"/>
18 <field name="type">form</field>18 <field name="type">form</field>
19 <field name="arch" type="xml">19 <field name="arch" type="xml">
20 <data>20 <data>
21 <field name="sequence" position="after">21 <field name="sequence" position="after">
22 <field name="magento_attribut_option" />22 <field name="magento_attribut_option" />
23 </field>23 </field>
24 </data>24 </data>
25 </field>25 </field>
26 </record>26 </record>
2727
28 <record id="magentoerpconnect_cp_product_variant_dimension_option_view_tree" model="ir.ui.view">28 <record id="magentoerpconnect_cp_product_variant_dimension_option_view_tree" model="ir.ui.view">
29 <field name="name">magentoerpconnect_cp.product_variant_dimension_option.view_tree</field>29 <field name="name">magentoerpconnect_cp.product_variant_dimension_option.view_tree</field>
30 <field name="model">product.variant.dimension.option</field>30 <field name="model">product.variant.dimension.option</field>
31 <field name="inherit_id" ref="product_variant_multi.product_variant_multi_dimension_option_tree" />31 <field name="inherit_id" ref="product_variant_multi.product_variant_multi_dimension_option_tree" />
32 <field eval="16" name="priority"/>32 <field eval="16" name="priority"/>
33 <field name="type">tree</field>33 <field name="type">tree</field>
34 <field name="arch" type="xml">34 <field name="arch" type="xml">
35 <data>35 <data>
36 <field name="sequence" position="after">36 <field name="sequence" position="after">
37 <field name="magento_attribut_option" />37 <field name="magento_attribut_option" />
38 </field>38 </field>
39 </data>39 </data>
40 </field>40 </field>
41 </record> 41 </record>
4242
4343
44 <!-- INHERITED VIEW FOR THE OBJECT : product_variant_dimension_type -->44 <!-- INHERITED VIEW FOR THE OBJECT : product_variant_dimension_type -->
4545
46 <record id="magentoerpconnect_cp_product_variant_dimension_type_view_form" model="ir.ui.view">46 <record id="magentoerpconnect_cp_product_variant_dimension_type_view_form" model="ir.ui.view">
47 <field name="name">magentoerpconnect_cp.product_variant_dimension_type.view_form</field>47 <field name="name">magentoerpconnect_cp.product_variant_dimension_type.view_form</field>
48 <field name="model">product.variant.dimension.type</field>48 <field name="model">product.variant.dimension.type</field>
49 <field name="inherit_id" ref="product_variant_multi.product_variant_multi_dimension_type_form" />49 <field name="inherit_id" ref="product_variant_multi.product_variant_multi_dimension_type_form" />
50 <field eval="16" name="priority"/>50 <field eval="16" name="priority"/>
51 <field name="type">form</field>51 <field name="type">form</field>
52 <field name="arch" type="xml">52 <field name="arch" type="xml">
53 <data>53 <data>
54 <field name="description" position="after">54 <field name="description" position="after">
55 <field name="magento_attribut" />55 <field name="magento_attribut" />
56 </field>56 </field>
57 </data>57 </data>
58 </field>58 </field>
59 </record>59 </record>
6060
61 <record id="magentoerpconnect_cp_product_variant_dimension_type_view_tree" model="ir.ui.view">61 <record id="magentoerpconnect_cp_product_variant_dimension_type_view_tree" model="ir.ui.view">
62 <field name="name">magentoerpconnect_cp.product_variant_dimension_type.view_tree</field>62 <field name="name">magentoerpconnect_cp.product_variant_dimension_type.view_tree</field>
63 <field name="model">product.variant.dimension.type</field>63 <field name="model">product.variant.dimension.type</field>
64 <field name="inherit_id" ref="product_variant_multi.product_variant_multi_dimension_type_tree" />64 <field name="inherit_id" ref="product_variant_multi.product_variant_multi_dimension_type_tree" />
65 <field eval="16" name="priority"/>65 <field eval="16" name="priority"/>
66 <field name="type">tree</field>66 <field name="type">tree</field>
67 <field name="arch" type="xml">67 <field name="arch" type="xml">
68 <data>68 <data>
69 <field name="description" position="after">69 <field name="description" position="after">
70 <field name="magento_attribut" />70 <field name="magento_attribut" />
71 </field>71 </field>
72 </data>72 </data>
73 </field>73 </field>
74 </record>74 </record>
75 75
76 <!-- INHERITED VIEW FOR THE OBJECT : product_template -->76 <!-- INHERITED VIEW FOR THE OBJECT : product_template -->
7777
78 <record id="magentoerpconnect_cp_product_template_view_form" model="ir.ui.view">78 <record id="magentoerpconnect_cp_product_template_view_form" model="ir.ui.view">
79 <field name="name">magentoerpconnect_cp.product_template.view_form</field>79 <field name="name">magentoerpconnect_cp.product_template.view_form</field>
80 <field name="model">product.template</field>80 <field name="model">product.template</field>
81 <field name="inherit_id" ref="product_variant_multi.product_variant_multi_product_template_form_view" />81 <field name="inherit_id" ref="product_variant_multi.product_variant_multi_product_template_form_view" />
82 <field eval="16" name="priority"/>82 <field eval="16" name="priority"/>
83 <field name="type">form</field>83 <field name="type">form</field>
84 <field name="arch" type="xml">84 <field name="arch" type="xml">
85 <data>85 <data>
86 <field name="is_multi_variants" position="after">86 <field name="is_multi_variants" position="after">
87 <field name="set" />87 <field name="set" />
88 </field>88 </field>
89 <field name="variants" position="after">89 <field name="variants" position="after">
90 <field name="product_type" />90 <field name="product_type" />
91 </field>91 </field>
9292
93 <xpath expr="/form/notebook" position="before">93 <xpath expr="/form/notebook" position="before">
94 <group colsan="1">94 <group colsan="1">
@@ -98,12 +98,12 @@
98 <xpath expr="/form/notebook" position="inside">98 <xpath expr="/form/notebook" position="inside">
99 <page string="attributes_placeholder"/>99 <page string="attributes_placeholder"/>
100 </xpath>100 </xpath>
101 <field name="variant_track_outgoing" position="after">101 <field name="variant_track_outgoing" position="after">
102 <field name="magento_exportable"/>102 <field name="magento_exportable"/>
103 </field>103 </field>
104 </data>104 </data>
105 </field>105 </field>
106 </record>106 </record>
107107
108 <!--Magento Product Template Wizard Form view -->108 <!--Magento Product Template Wizard Form view -->
109109