Merge lp:~sebastien.beau/magentoerpconnect/oerp6.1-cleanning into lp:magentoerpconnect/oerp6.1-stable
- oerp6.1-cleanning
- Merge into oerp6.1-stable
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 |
Related bugs: |
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:
|
Commit message
Description of the change

Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote : | # |

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_
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.
- 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 informationADD
- add reporting when exporting stock level
Preview Diff
1 | === modified file 'magento_product_auto_sku/__openerp__.py' | |||
2 | --- magento_product_auto_sku/__openerp__.py 2012-03-15 09:47:04 +0000 | |||
3 | +++ magento_product_auto_sku/__openerp__.py 2012-12-03 15:22:20 +0000 | |||
4 | @@ -20,7 +20,7 @@ | |||
5 | 20 | ############################################################################## | 20 | ############################################################################## |
6 | 21 | { | 21 | { |
7 | 22 | 'name' : 'magento_product_auto_sku', | 22 | 'name' : 'magento_product_auto_sku', |
9 | 23 | 'version' : '1.0', | 23 | 'version' : '6.1.0', |
10 | 24 | 'depends' : ['base', 'product', 'magentoerpconnect'], | 24 | 'depends' : ['base', 'product', 'magentoerpconnect'], |
11 | 25 | 'author' : 'Camptocamp', | 25 | 'author' : 'Camptocamp', |
12 | 26 | 'license': 'AGPL-3', | 26 | 'license': 'AGPL-3', |
13 | 27 | 27 | ||
14 | === modified file 'magento_product_auto_sku/data.xml' | |||
15 | --- magento_product_auto_sku/data.xml 2011-06-07 14:51:43 +0000 | |||
16 | +++ magento_product_auto_sku/data.xml 2012-12-03 15:22:20 +0000 | |||
17 | @@ -11,8 +11,8 @@ | |||
18 | 11 | <field name="name">Product Magento SKU</field> | 11 | <field name="name">Product Magento SKU</field> |
19 | 12 | <field name="code">product.magento.sku</field> | 12 | <field name="code">product.magento.sku</field> |
20 | 13 | <field name="prefix">%(year)s/</field> | 13 | <field name="prefix">%(year)s/</field> |
24 | 14 | <field name="padding">5</field> | 14 | <field name="padding">5</field> |
25 | 15 | </record> | 15 | </record> |
26 | 16 | 16 | ||
27 | 17 | </data> | 17 | </data> |
28 | 18 | </openerp> | 18 | </openerp> |
29 | 19 | 19 | ||
30 | === modified file 'magento_product_auto_sku/product.py' | |||
31 | --- magento_product_auto_sku/product.py 2012-03-15 09:47:04 +0000 | |||
32 | +++ magento_product_auto_sku/product.py 2012-12-03 15:22:20 +0000 | |||
33 | @@ -17,25 +17,19 @@ | |||
34 | 17 | # You should have received a copy of the GNU Affero General Public License | 17 | # You should have received a copy of the GNU Affero General Public License |
35 | 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/>. |
36 | 19 | # | 19 | # |
42 | 20 | ############################################################################## | 20 | ############################################################################## |
43 | 21 | from osv import osv, fields | 21 | from openerp.osv.orm import Model |
44 | 22 | 22 | from openerp.osv import fields | |
45 | 23 | 23 | ||
46 | 24 | class Product(osv.osv): | 24 | class Product(Model): |
47 | 25 | " Inherit product to add the sequence on the Magento SKU field" | 25 | " Inherit product to add the sequence on the Magento SKU field" |
48 | 26 | _inherit = 'product.product' | 26 | _inherit = 'product.product' |
57 | 27 | 27 | _columns = {'magento_sku':fields.char('Magento SKU', size=64, readonly=True), | |
58 | 28 | _columns = { | 28 | } |
59 | 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'), |
60 | 30 | } | 30 | } |
53 | 31 | |||
54 | 32 | _defaults = { | ||
55 | 33 | 'magento_sku':lambda obj, cr, uid, context: obj.pool.get('ir.sequence').get(cr, uid, 'product.magento.sku'), | ||
56 | 34 | } | ||
61 | 35 | 31 | ||
62 | 36 | def copy(self, cr, uid, id, default=None, context=None): | 32 | def copy(self, cr, uid, id, default=None, context=None): |
63 | 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') |
64 | 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) |
65 | 39 | 35 | ||
66 | 40 | Product() | ||
67 | 41 | |||
68 | 42 | 36 | ||
69 | === removed directory 'magento_sku_is_code' | |||
70 | === removed file 'magento_sku_is_code/__init__.py' | |||
71 | --- magento_sku_is_code/__init__.py 2012-03-15 09:47:04 +0000 | |||
72 | +++ magento_sku_is_code/__init__.py 1970-01-01 00:00:00 +0000 | |||
73 | @@ -1,22 +0,0 @@ | |||
74 | 1 | # -*- coding: utf-8 -*- | ||
75 | 2 | ############################################################################## | ||
76 | 3 | # | ||
77 | 4 | # Author: Guewen Baconnier | ||
78 | 5 | # Copyright 2011-2012 Camptocamp SA | ||
79 | 6 | # | ||
80 | 7 | # This program is free software: you can redistribute it and/or modify | ||
81 | 8 | # it under the terms of the GNU Affero General Public License as | ||
82 | 9 | # published by the Free Software Foundation, either version 3 of the | ||
83 | 10 | # License, or (at your option) any later version. | ||
84 | 11 | # | ||
85 | 12 | # This program is distributed in the hope that it will be useful, | ||
86 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
87 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
88 | 15 | # GNU Affero General Public License for more details. | ||
89 | 16 | # | ||
90 | 17 | # You should have received a copy of the GNU Affero General Public License | ||
91 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
92 | 19 | # | ||
93 | 20 | ############################################################################## | ||
94 | 21 | |||
95 | 22 | import product | ||
96 | 23 | 0 | ||
97 | === removed file 'magento_sku_is_code/__openerp__.py' | |||
98 | --- magento_sku_is_code/__openerp__.py 2012-03-15 09:47:04 +0000 | |||
99 | +++ magento_sku_is_code/__openerp__.py 1970-01-01 00:00:00 +0000 | |||
100 | @@ -1,41 +0,0 @@ | |||
101 | 1 | # -*- coding: utf-8 -*- | ||
102 | 2 | ############################################################################## | ||
103 | 3 | # | ||
104 | 4 | # Author: Guewen Baconnier | ||
105 | 5 | # Copyright 2011-2012 Camptocamp SA | ||
106 | 6 | # | ||
107 | 7 | # This program is free software: you can redistribute it and/or modify | ||
108 | 8 | # it under the terms of the GNU Affero General Public License as | ||
109 | 9 | # published by the Free Software Foundation, either version 3 of the | ||
110 | 10 | # License, or (at your option) any later version. | ||
111 | 11 | # | ||
112 | 12 | # This program is distributed in the hope that it will be useful, | ||
113 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
114 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
115 | 15 | # GNU Affero General Public License for more details. | ||
116 | 16 | # | ||
117 | 17 | # You should have received a copy of the GNU Affero General Public License | ||
118 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
119 | 19 | # | ||
120 | 20 | ############################################################################## | ||
121 | 21 | |||
122 | 22 | { | ||
123 | 23 | "name" : "Magento sku is product's code", | ||
124 | 24 | "version" : "1.0", | ||
125 | 25 | "depends" : ["base", | ||
126 | 26 | "product", | ||
127 | 27 | "magentoerpconnect",], | ||
128 | 28 | "author" : "Camptocamp", | ||
129 | 29 | "license": 'AGPL-3', | ||
130 | 30 | "description": """Use product's code as SKU for Magento. | ||
131 | 31 | Once exported to Magento, the Magento SKU is not changed, even if you change the product's code. | ||
132 | 32 | """, | ||
133 | 33 | "website" : "http://www.camptocamp.com", | ||
134 | 34 | "category" : "Generic Modules", | ||
135 | 35 | "init_xml" : [], | ||
136 | 36 | "demo_xml" : [], | ||
137 | 37 | "update_xml" : ['product_view.xml'], | ||
138 | 38 | "active": False, | ||
139 | 39 | "installable": True, | ||
140 | 40 | |||
141 | 41 | } | ||
142 | 42 | 0 | ||
143 | === removed directory 'magento_sku_is_code/i18n' | |||
144 | === removed file 'magento_sku_is_code/product.py' | |||
145 | --- magento_sku_is_code/product.py 2012-03-15 09:47:04 +0000 | |||
146 | +++ magento_sku_is_code/product.py 1970-01-01 00:00:00 +0000 | |||
147 | @@ -1,66 +0,0 @@ | |||
148 | 1 | # -*- coding: utf-8 -*- | ||
149 | 2 | ############################################################################## | ||
150 | 3 | # | ||
151 | 4 | # Author: Guewen Baconnier | ||
152 | 5 | # Copyright 2011-2012 Camptocamp SA | ||
153 | 6 | # | ||
154 | 7 | # This program is free software: you can redistribute it and/or modify | ||
155 | 8 | # it under the terms of the GNU Affero General Public License as | ||
156 | 9 | # published by the Free Software Foundation, either version 3 of the | ||
157 | 10 | # License, or (at your option) any later version. | ||
158 | 11 | # | ||
159 | 12 | # This program is distributed in the hope that it will be useful, | ||
160 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
161 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
162 | 15 | # GNU Affero General Public License for more details. | ||
163 | 16 | # | ||
164 | 17 | # You should have received a copy of the GNU Affero General Public License | ||
165 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
166 | 19 | # | ||
167 | 20 | ############################################################################## | ||
168 | 21 | |||
169 | 22 | from osv import osv, fields | ||
170 | 23 | |||
171 | 24 | |||
172 | 25 | class Product(osv.osv): | ||
173 | 26 | """Inherit product to use the default code as the Magento SKU. Copy the default code into the magento_sku field.""" | ||
174 | 27 | _inherit = 'product.product' | ||
175 | 28 | |||
176 | 29 | _columns = {'magento_sku':fields.char('Magento SKU', size=64, readonly=True),} | ||
177 | 30 | |||
178 | 31 | _sql_constraints = [('code_uniq', 'unique(default_code)', 'The code must be unique')] | ||
179 | 32 | |||
180 | 33 | def _get_sku(self, cr, uid, vals, product=None, context=None): | ||
181 | 34 | """ | ||
182 | 35 | Returns the SKU value. | ||
183 | 36 | @param vals: vals to be created / modified | ||
184 | 37 | @param product: optional browse instance of the product (when writing) | ||
185 | 38 | """ | ||
186 | 39 | return vals['default_code'] | ||
187 | 40 | |||
188 | 41 | def create(self, cr, uid, vals, context=None): | ||
189 | 42 | if vals.get('default_code'): | ||
190 | 43 | vals['magento_sku'] = self._get_sku(cr, uid, vals, context=context) | ||
191 | 44 | return super(Product, self).create(cr, uid, vals, context) | ||
192 | 45 | |||
193 | 46 | def write(self, cr, uid, ids, vals, context=None): | ||
194 | 47 | if isinstance(ids, (int, long)): | ||
195 | 48 | ids = [ids] | ||
196 | 49 | ids_to_write = ids[:] | ||
197 | 50 | if vals.get('default_code'): | ||
198 | 51 | for product in self.browse(cr, uid, ids, context=context): | ||
199 | 52 | # write separately on each product if they are not already exported | ||
200 | 53 | if not product.magento_exported: | ||
201 | 54 | new_vals = vals.copy() | ||
202 | 55 | new_vals['magento_sku'] = self._get_sku(cr, uid, new_vals, product=product, context=context) | ||
203 | 56 | super(Product, self).write(cr, uid, [product.id], new_vals, context=context) | ||
204 | 57 | ids_to_write.remove(product.id) | ||
205 | 58 | |||
206 | 59 | return super(Product, self).write(cr, uid, ids_to_write, vals, context=context) | ||
207 | 60 | |||
208 | 61 | def copy(self, cr, uid, id, default=None, context=None): | ||
209 | 62 | if not default is None: default = {} | ||
210 | 63 | default['default_code'] = False | ||
211 | 64 | return super(Product, self).copy(cr, uid, id, default=default, context=context) | ||
212 | 65 | |||
213 | 66 | Product() | ||
214 | 67 | 0 | ||
215 | === removed file 'magento_sku_is_code/product_view.xml' | |||
216 | --- magento_sku_is_code/product_view.xml 2011-11-28 10:01:34 +0000 | |||
217 | +++ magento_sku_is_code/product_view.xml 1970-01-01 00:00:00 +0000 | |||
218 | @@ -1,24 +0,0 @@ | |||
219 | 1 | <?xml version="1.0" encoding="utf-8"?> | ||
220 | 2 | <openerp> | ||
221 | 3 | <data> | ||
222 | 4 | <record model="ir.ui.view" id="product_product_form_view_magerp_sku"> | ||
223 | 5 | <field name="name">product.normal.form_magerp.sku</field> | ||
224 | 6 | <field name="model">product.product</field> | ||
225 | 7 | <field name="type">form</field> | ||
226 | 8 | <field name="inherit_id" ref="magentoerpconnect.product_product_form_view_magerp"/> | ||
227 | 9 | <field name="arch" type="xml"> | ||
228 | 10 | <data> | ||
229 | 11 | <field name="default_code" position="attributes"> | ||
230 | 12 | <attribute name="attrs">{'required':[('magento_exportable','=',True)]}</attribute> | ||
231 | 13 | </field> | ||
232 | 14 | <field name="magento_sku" position="attributes"> | ||
233 | 15 | <attribute name="attrs"/> | ||
234 | 16 | </field> | ||
235 | 17 | <field name="magento_sku" position="attributes"> | ||
236 | 18 | <attribute name="readonly">True</attribute> | ||
237 | 19 | </field> | ||
238 | 20 | </data> | ||
239 | 21 | </field> | ||
240 | 22 | </record> | ||
241 | 23 | </data> | ||
242 | 24 | </openerp> | ||
243 | 25 | 0 | ||
244 | === removed directory 'magento_sku_is_code/security' | |||
245 | === modified file 'magentoerpconnect/__openerp__.py' | |||
246 | --- magentoerpconnect/__openerp__.py 2012-05-16 08:01:05 +0000 | |||
247 | +++ magentoerpconnect/__openerp__.py 2012-12-03 15:22:20 +0000 | |||
248 | @@ -18,14 +18,14 @@ | |||
249 | 18 | ######################################################################### | 18 | ######################################################################### |
250 | 19 | { | 19 | { |
251 | 20 | "name" : "Magento e-commerce", | 20 | "name" : "Magento e-commerce", |
253 | 21 | "version" : "1.0", | 21 | "version" : "6.1.1", |
254 | 22 | "depends" : ["base", | 22 | "depends" : ["base", |
255 | 23 | "product", | 23 | "product", |
256 | 24 | "product_m2mcategories", | 24 | "product_m2mcategories", |
257 | 25 | 'delivery', | 25 | 'delivery', |
258 | 26 | "base_sale_multichannels", | 26 | "base_sale_multichannels", |
259 | 27 | "product_images_olbs", | 27 | "product_images_olbs", |
261 | 28 | "product_links", | 28 | "product_links_sync", |
262 | 29 | ], | 29 | ], |
263 | 30 | "author" : "MagentoERPconnect Core Editors", | 30 | "author" : "MagentoERPconnect Core Editors", |
264 | 31 | "description": """Magento E-commerce management | 31 | "description": """Magento E-commerce management |
265 | 32 | 32 | ||
266 | === modified file 'magentoerpconnect/delivery.py' | |||
267 | --- magentoerpconnect/delivery.py 2012-03-27 09:52:57 +0000 | |||
268 | +++ magentoerpconnect/delivery.py 2012-12-03 15:22:20 +0000 | |||
269 | @@ -19,10 +19,12 @@ | |||
270 | 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/>. # |
271 | 20 | ######################################################################### | 20 | ######################################################################### |
272 | 21 | 21 | ||
275 | 22 | from osv import fields,osv | 22 | from openerp.osv.orm import Model |
276 | 23 | from tools.translate import _ | 23 | from openerp.osv import fields |
277 | 24 | from openerp.osv.osv import except_osv | ||
278 | 25 | from openerp.tools.translate import _ | ||
279 | 24 | 26 | ||
281 | 25 | class delivery_carrier(osv.osv): | 27 | class delivery_carrier(Model): |
282 | 26 | _inherit = "delivery.carrier" | 28 | _inherit = "delivery.carrier" |
283 | 27 | 29 | ||
284 | 28 | def _carrier_code(self, cr, uid, ids, name, args, context=None): | 30 | def _carrier_code(self, cr, uid, ids, name, args, context=None): |
285 | @@ -57,7 +59,7 @@ | |||
286 | 57 | carrier = self.read( | 59 | carrier = self.read( |
287 | 58 | cr, uid, id, ['magento_carrier_code', 'name'], context=context) | 60 | cr, uid, id, ['magento_carrier_code', 'name'], context=context) |
288 | 59 | if not carrier['magento_carrier_code'] in mag_carrier.keys(): | 61 | if not carrier['magento_carrier_code'] in mag_carrier.keys(): |
290 | 60 | raise osv.except_osv( | 62 | raise except_osv( |
291 | 61 | _("Error"), | 63 | _("Error"), |
292 | 62 | _("The carrier %s doesn't have a magento_code valid !" | 64 | _("The carrier %s doesn't have a magento_code valid !" |
293 | 63 | "The value %s is not in the carrier list %s " | 65 | "The value %s is not in the carrier list %s " |
294 | 64 | 66 | ||
295 | === modified file 'magentoerpconnect/delivery_view.xml' | |||
296 | --- magentoerpconnect/delivery_view.xml 2011-06-07 14:33:14 +0000 | |||
297 | +++ magentoerpconnect/delivery_view.xml 2012-12-03 15:22:20 +0000 | |||
298 | @@ -10,8 +10,8 @@ | |||
299 | 10 | <field name="arch" type="xml"> | 10 | <field name="arch" type="xml"> |
300 | 11 | <data> | 11 | <data> |
301 | 12 | <field name="product_id" select="1" position="after"> | 12 | <field name="product_id" select="1" position="after"> |
304 | 13 | <field name="magento_code"/> | 13 | <field name="magento_code"/> |
305 | 14 | <field name="magento_tracking_title"/> | 14 | <field name="magento_tracking_title"/> |
306 | 15 | </field> | 15 | </field> |
307 | 16 | </data> | 16 | </data> |
308 | 17 | </field> | 17 | </field> |
309 | 18 | 18 | ||
310 | === modified file 'magentoerpconnect/invoice.py' | |||
311 | --- magentoerpconnect/invoice.py 2012-06-01 17:48:14 +0000 | |||
312 | +++ magentoerpconnect/invoice.py 2012-12-03 15:22:20 +0000 | |||
313 | @@ -21,26 +21,27 @@ | |||
314 | 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/>. # |
315 | 22 | ######################################################################### | 22 | ######################################################################### |
316 | 23 | 23 | ||
319 | 24 | from osv import osv, fields | 24 | from openerp.osv.orm import Model |
320 | 25 | from tools.translate import _ | 25 | from openerp.osv import fields |
321 | 26 | from openerp.tools.translate import _ | ||
322 | 27 | from base_external_referentials.external_osv import ExternalSession | ||
323 | 28 | from openerp.osv.osv import except_osv | ||
324 | 26 | 29 | ||
326 | 27 | class account_invoice(osv.osv): | 30 | class account_invoice(Model): |
327 | 28 | _inherit = "account.invoice" | 31 | _inherit = "account.invoice" |
328 | 29 | |||
329 | 30 | _columns = { | 32 | _columns = { |
330 | 31 | 'magento_ref':fields.char('Magento REF', size=32), | 33 | 'magento_ref':fields.char('Magento REF', size=32), |
338 | 32 | } | 34 | } |
339 | 33 | 35 | ||
340 | 34 | 36 | ||
341 | 35 | #TODO instead of calling again the sale order information | 37 | #TODO instead of calling again the sale order information |
342 | 36 | # it will be better to store the ext_id of each sale order line | 38 | # it will be better to store the ext_id of each sale order line |
343 | 37 | #Moreover some code should be share between the partial export of picking and invoice | 39 | #Moreover some code should be share between the partial export of picking and invoice |
337 | 38 | |||
344 | 39 | def add_invoice_line(self, cr, uid, lines, line, context=None): | 40 | def add_invoice_line(self, cr, uid, lines, line, context=None): |
345 | 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.""" |
346 | 41 | line_info = {'product_id': line.product_id.id, | 42 | line_info = {'product_id': line.product_id.id, |
347 | 42 | 'product_qty': line.quantity, | 43 | 'product_qty': line.quantity, |
349 | 43 | } | 44 | } |
350 | 44 | lines.append(line_info) | 45 | lines.append(line_info) |
351 | 45 | return lines | 46 | return lines |
352 | 46 | 47 | ||
353 | @@ -55,7 +56,7 @@ | |||
354 | 55 | for item in order_items: | 56 | for item in order_items: |
355 | 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'], |
356 | 57 | external_session.referential_id.id, context={}): item['item_id']}) | 58 | external_session.referential_id.id, context={}): item['item_id']}) |
358 | 58 | 59 | ||
359 | 59 | lines = [] | 60 | lines = [] |
360 | 60 | # get product and quantities to invoice from the invoice | 61 | # get product and quantities to invoice from the invoice |
361 | 61 | for line in invoice.invoice_line: | 62 | for line in invoice.invoice_line: |
362 | @@ -70,31 +71,80 @@ | |||
363 | 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']}) |
364 | 71 | return item_qty | 72 | return item_qty |
365 | 72 | 73 | ||
366 | 74 | def map_magento_order(self, cr, uid, external_session, invoice_id, order_increment_id, context=None): | ||
367 | 75 | #TODO Error should be catch by the external report system (need some improvement before) | ||
368 | 76 | #For now error are just logged into the OpenERP log file | ||
369 | 77 | try: | ||
370 | 78 | external_session.logger.warning('Try to map the invoice with an existing order') | ||
371 | 79 | invoice_ids = external_session.connection.call('sales_order.get_invoice_ids', [order_increment_id]) | ||
372 | 80 | #TODO support mapping for partiel invoice if needed | ||
373 | 81 | if len(invoice_ids) == 1: | ||
374 | 82 | external_session.logger.info( | ||
375 | 83 | 'Success to map the invoice %s with an existing order for the order %s.' | ||
376 | 84 | %(invoice_ids[0], order_increment_id)) | ||
377 | 85 | return invoice_ids[0] | ||
378 | 86 | else: | ||
379 | 87 | external_session.logger.error( | ||
380 | 88 | 'Failed to map the invoice %s with an existing order for the order %s. Too many invoice found' | ||
381 | 89 | %(invoice_ids[0], order_increment_id)) | ||
382 | 90 | return False | ||
383 | 91 | except Exception, e: | ||
384 | 92 | external_session.logger.error( | ||
385 | 93 | 'Failed to map the invoice with an existing order for the order %s. Error : %s' | ||
386 | 94 | %(order_increment_id, e)) | ||
387 | 95 | return False | ||
388 | 96 | |||
389 | 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): |
390 | 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) |
391 | 75 | try: | 99 | try: |
392 | 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, |
393 | 77 | item_qty, _('Invoice Created'), False, False]) | 101 | item_qty, _('Invoice Created'), False, False]) |
394 | 78 | except Exception, e: | 102 | except Exception, e: |
397 | 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( |
398 | 80 | return False | 104 | 'Can not create the invoice for the order %s in the external system. Error : %s' |
399 | 105 | %(order_increment_id, e)) | ||
400 | 106 | invoice_id = self.map_magento_order(cr, uid, external_session, invoice_id, order_increment_id, context=context) | ||
401 | 107 | if invoice_id: | ||
402 | 108 | return invoice_id | ||
403 | 109 | else: | ||
404 | 110 | raise except_osv(_('Magento Error'), _('Failed to synchronize Magento invoice with OpenERP invoice')) | ||
405 | 81 | 111 | ||
406 | 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): |
407 | 83 | ext_create_ids={} | 113 | ext_create_ids={} |
408 | 84 | for resource_id, resource in resources.items(): | 114 | for resource_id, resource in resources.items(): |
413 | 85 | resource = resource[resource.keys()[0]] | 115 | res = self.ext_create_one_invoice(cr, uid, external_session, resource_id, resource, context=context) |
414 | 86 | if resource['type'] == 'out_invoice': | 116 | if res: |
415 | 87 | ext_create_ids[resource_id] = self.create_magento_invoice(cr, uid, external_session, | 117 | ext_create_ids[resource_id] = res |
412 | 88 | resource_id, resource['order_increment_id'], context=context) | ||
416 | 89 | return ext_create_ids | 118 | return ext_create_ids |
417 | 90 | 119 | ||
423 | 91 | account_invoice() | 120 | def ext_create_one_invoice(self, cr, uid, external_session, resource_id, resource, context=None): |
424 | 92 | 121 | resource = resource[resource.keys()[0]] | |
425 | 93 | 122 | if resource['type'] == 'out_invoice': | |
426 | 94 | class account_invoice_line(osv.osv): | 123 | return self.create_magento_invoice(cr, uid, external_session, |
427 | 95 | 124 | resource_id, resource['order_increment_id'], context=context) | |
428 | 125 | return False | ||
429 | 126 | |||
430 | 127 | def _export_one_invoice(self, cr, uid, invoice, context=None): | ||
431 | 128 | if invoice.sale_ids: | ||
432 | 129 | sale = invoice.sale_ids[0] | ||
433 | 130 | referential = sale.shop_id.referential_id | ||
434 | 131 | if referential and referential.type_name == 'Magento': | ||
435 | 132 | ext_id = invoice.get_extid(referential.id) | ||
436 | 133 | if ext_id: | ||
437 | 134 | return ext_id | ||
438 | 135 | else: | ||
439 | 136 | external_session = ExternalSession(referential, sale.shop_id) | ||
440 | 137 | return self._export_one_resource(cr, uid, external_session, invoice.id, | ||
441 | 138 | context=context) | ||
442 | 139 | |||
443 | 140 | def export_invoice(self, cr, uid, ids, context=None): | ||
444 | 141 | for invoice in self .browse(cr, uid, ids, context=context): | ||
445 | 142 | self._export_one_invoice(cr, uid, invoice, context=context) | ||
446 | 143 | return True | ||
447 | 144 | |||
448 | 145 | |||
449 | 146 | class account_invoice_line(Model): | ||
450 | 96 | _inherit = 'account.invoice.line' | 147 | _inherit = 'account.invoice.line' |
451 | 97 | |||
452 | 98 | _columns = { | 148 | _columns = { |
453 | 99 | # Forced the precision of the account.invoice.line discount field | 149 | # Forced the precision of the account.invoice.line discount field |
454 | 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. |
455 | @@ -103,5 +153,4 @@ | |||
456 | 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. |
457 | 104 | # Force the digits to 3 allows to have 50.167% => 149€ | 154 | # Force the digits to 3 allows to have 50.167% => 149€ |
458 | 105 | 'discount': fields.float('Discount (%)', digits=(16, 3)), | 155 | 'discount': fields.float('Discount (%)', digits=(16, 3)), |
461 | 106 | } | 156 | } |
460 | 107 | account_invoice_line() | ||
462 | 108 | 157 | ||
463 | === modified file 'magentoerpconnect/magerp_core.py' | |||
464 | --- magentoerpconnect/magerp_core.py 2012-05-25 15:37:26 +0000 | |||
465 | +++ magentoerpconnect/magerp_core.py 2012-12-03 15:22:20 +0000 | |||
466 | @@ -22,24 +22,30 @@ | |||
467 | 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/>. # |
468 | 23 | ######################################################################### | 23 | ######################################################################### |
469 | 24 | 24 | ||
470 | 25 | from osv import osv, fields | ||
471 | 26 | import magerp_osv | ||
472 | 27 | import pooler | ||
473 | 28 | import base64, urllib | ||
474 | 29 | from magerp_osv import Connection | ||
475 | 30 | import tools | ||
476 | 31 | from tools.translate import _ | ||
477 | 32 | import os | 25 | import os |
478 | 26 | import logging | ||
479 | 27 | |||
480 | 28 | from openerp.osv import fields | ||
481 | 29 | from openerp.osv.osv import except_osv | ||
482 | 30 | from openerp import pooler | ||
483 | 31 | from openerp import tools | ||
484 | 32 | from openerp.tools.translate import _ | ||
485 | 33 | |||
486 | 34 | from .magerp_osv import MagerpModel, Connection | ||
487 | 33 | from base_external_referentials.decorator import only_for_referential | 35 | from base_external_referentials.decorator import only_for_referential |
488 | 34 | from base_external_referentials.external_osv import ExternalSession | 36 | from base_external_referentials.external_osv import ExternalSession |
489 | 35 | 37 | ||
491 | 36 | import logging | 38 | from base_external_referentials.external_referentials import REF_VISIBLE_FIELDS |
492 | 39 | |||
493 | 40 | REF_VISIBLE_FIELDS['Magento'] = ['location', 'apiusername', 'apipass'] | ||
494 | 41 | |||
495 | 42 | |||
496 | 37 | _logger = logging.getLogger(__name__) | 43 | _logger = logging.getLogger(__name__) |
497 | 38 | 44 | ||
498 | 39 | DEBUG = True | 45 | DEBUG = True |
499 | 40 | TIMEOUT = 2 | 46 | TIMEOUT = 2 |
500 | 41 | 47 | ||
502 | 42 | class external_referential(magerp_osv.magerp_osv): | 48 | class external_referential(MagerpModel): |
503 | 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) |
504 | 44 | _inherit = "external.referential" | 50 | _inherit = "external.referential" |
505 | 45 | 51 | ||
506 | @@ -209,7 +215,7 @@ | |||
507 | 209 | if lang_id: | 215 | if lang_id: |
508 | 210 | lang = lang_id.code | 216 | lang = lang_id.code |
509 | 211 | else: | 217 | else: |
511 | 212 | osv.except_osv(_('Warning!'), _('The storeviews have no language defined')) | 218 | except_osv(_('Warning!'), _('The storeviews have no language defined')) #TODO needed? |
512 | 213 | lang = referential.default_lang_id.code | 219 | lang = referential.default_lang_id.code |
513 | 214 | if not lang_2_storeview.get(lang, False): | 220 | if not lang_2_storeview.get(lang, False): |
514 | 215 | lang_2_storeview[lang] = storeview | 221 | lang_2_storeview[lang] = storeview |
515 | @@ -282,6 +288,7 @@ | |||
516 | 282 | shop.export_products(cr, uid, shop, context) | 288 | shop.export_products(cr, uid, shop, context) |
517 | 283 | return True | 289 | return True |
518 | 284 | 290 | ||
519 | 291 | #TODO refactor me | ||
520 | 285 | def sync_partner(self, cr, uid, ids, context=None): | 292 | def sync_partner(self, cr, uid, ids, context=None): |
521 | 286 | def next_partners(connection, start, step): | 293 | def next_partners(connection, start, step): |
522 | 287 | filters = {'customer_id': {'in': range(start, start + step)}} | 294 | filters = {'customer_id': {'in': range(start, start + step)}} |
523 | @@ -308,11 +315,10 @@ | |||
524 | 308 | address_info = customer_address_info[0] | 315 | address_info = customer_address_info[0] |
525 | 309 | address_info['customer_id'] = ext_customer_id | 316 | address_info['customer_id'] = ext_customer_id |
526 | 310 | address_info['email'] = customer_info['email'] | 317 | address_info['email'] = customer_info['email'] |
529 | 311 | 318 | external_session = ExternalSession(referential, referential) | |
530 | 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) |
531 | 313 | if address_info: | 320 | if address_info: |
534 | 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) |
533 | 315 | |||
535 | 316 | last_imported_id = int(ext_customer_id) | 322 | last_imported_id = int(ext_customer_id) |
536 | 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) |
537 | 318 | import_cr.commit() | 324 | import_cr.commit() |
538 | @@ -382,10 +388,8 @@ | |||
539 | 382 | if DEBUG: | 388 | if DEBUG: |
540 | 383 | print "run_import_newsletter_unsubscriber_scheduler: %s" % referential_ids | 389 | print "run_import_newsletter_unsubscriber_scheduler: %s" % referential_ids |
541 | 384 | 390 | ||
546 | 385 | external_referential() | 391 | |
547 | 386 | 392 | class external_shop_group(MagerpModel): | |
544 | 387 | |||
545 | 388 | class external_shop_group(magerp_osv.magerp_osv): | ||
548 | 389 | _inherit = "external.shop.group" | 393 | _inherit = "external.shop.group" |
549 | 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'} |
550 | 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) |
551 | @@ -407,12 +411,10 @@ | |||
552 | 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) |
553 | 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"), |
554 | 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'), |
561 | 410 | } | 414 | } |
562 | 411 | 415 | ||
563 | 412 | external_shop_group() | 416 | |
564 | 413 | 417 | class magerp_storeviews(MagerpModel): | |
559 | 414 | |||
560 | 415 | class magerp_storeviews(magerp_osv.magerp_osv): | ||
565 | 416 | _name = "magerp.storeviews" | 418 | _name = "magerp.storeviews" |
566 | 417 | _description = "The magento store views information" | 419 | _description = "The magento store views information" |
567 | 418 | 420 | ||
568 | @@ -427,5 +429,3 @@ | |||
569 | 427 | } | 429 | } |
570 | 428 | 430 | ||
571 | 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'} |
572 | 430 | |||
573 | 431 | magerp_storeviews() | ||
574 | 432 | 432 | ||
575 | === modified file 'magentoerpconnect/magerp_core_view.xml' | |||
576 | --- magentoerpconnect/magerp_core_view.xml 2012-05-19 12:23:36 +0000 | |||
577 | +++ magentoerpconnect/magerp_core_view.xml 2012-12-03 15:22:20 +0000 | |||
578 | @@ -1,172 +1,168 @@ | |||
579 | 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
580 | 2 | <openerp> | 2 | <openerp> |
583 | 3 | <data> | 3 | <data> |
584 | 4 | <!--Magento Instances Tree/Form view --> | 4 | <!--Magento Instances Tree/Form view --> |
585 | 5 | 5 | ||
606 | 6 | <record model="ir.ui.view" id="magerp_instances_form"> | 6 | <record model="ir.ui.view" id="magerp_instances_form"> |
607 | 7 | <field name="name">External Referentials</field> | 7 | <field name="name">External Referentials</field> |
608 | 8 | <field name="model">external.referential</field> | 8 | <field name="model">external.referential</field> |
609 | 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" /> |
610 | 10 | <field name="type">form</field> | 10 | <field name="type">form</field> |
611 | 11 | <field name="priority">30</field> | 11 | <field name="priority">30</field> |
612 | 12 | <field name="arch" type="xml"> | 12 | <field name="arch" type="xml"> |
613 | 13 | <xpath expr="/form/group[2]/notebook/page[@string='Referential Actions']" position="replace"> | 13 | <group name="compulsory" position="after"> |
614 | 14 | <page string="Referential Actions"> | 14 | <group name="magento" col="4" colspan="4" attrs="{'invisible': [['type_name', '!=', 'Magento']]}"> |
615 | 15 | <separator string="Compulsory" colspan="4" /> | 15 | <separator string="Optional - Initial import only" colspan="4" /> |
616 | 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" /> |
617 | 17 | <button name="import_referentials" string="2 - Synchronize Referential Settings" colspan="2" type="object" attrs="{'readonly':[('mapping_ids','=',[])]}"/> | 17 | <group colspan="2" col="12"> |
618 | 18 | <separator string="Optional - Initial import only" colspan="4" /> | 18 | <button name="sync_attribs" string="5 - Import Product Attributes" colspan="10" type="object" /> |
619 | 19 | <button name="import_customer_groups" string="1 - Import Customer Groups (Partner Categories)" colspan="2" type="object" /> | 19 | <field name="import_all_attributs"/> |
620 | 20 | <group colspan="2" col="12"> | 20 | </group> |
621 | 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" /> |
622 | 22 | <field name="import_all_attributs"/> | 22 | <group colspan="2" col="14"> |
603 | 23 | </group> | ||
604 | 24 | <button name="import_product_categories" string="2 - Import Product Categories" colspan="2" type="object" /> | ||
605 | 25 | <group colspan="2" col="14"> | ||
623 | 26 | <group colspan="8"> | 23 | <group colspan="8"> |
625 | 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)]}" /> |
626 | 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)]}" /> |
627 | 29 | </group> | 26 | </group> |
629 | 30 | <field name="import_image_with_product"/> | 27 | <field name="import_image_with_product"/> |
630 | 31 | <field name="import_links_with_product"/> | 28 | <field name="import_links_with_product"/> |
636 | 32 | <field name="last_imported_product_id" string=""/> | 29 | <field name="last_imported_product_id" string=""/> |
637 | 33 | </group> | 30 | </group> |
638 | 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" /> |
639 | 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)]}"/> |
640 | 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" /> |
641 | 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" /> |
649 | 38 | <separator string="Default values" colspan="4" /> | 35 | <separator string="Default values" colspan="4" /> |
650 | 39 | <field name="default_pro_cat" required="1"/> | 36 | <field name="default_pro_cat" attrs="{'required': [['type_name', '=', 'Magento']]}"/> |
651 | 40 | <field name="default_lang_id" required="1"/> | 37 | <field name="default_lang_id" attrs="{'required': [['type_name', '=', 'Magento']]}"/> |
652 | 41 | <!-- <button name="sync_customer_addresses" string="Sync Customer Addresses" colspan="2" type="object" />--> | 38 | </group> |
653 | 42 | <!-- <button name="export_products" string="Export Products" colspan="2" type="object" />--> | 39 | </group> |
647 | 43 | </page> | ||
648 | 44 | </xpath> | ||
654 | 45 | 40 | ||
670 | 46 | <xpath expr="/form/group[2]/notebook" position="inside"> | 41 | <notebook position="inside"> |
671 | 47 | <page string="Websites"> | 42 | <page string="Websites" attrs="{'invisible': [['type_name', '!=', 'Magento']]}"> |
672 | 48 | <field name="shop_group_ids" nolabel="1" /> | 43 | <field name="shop_group_ids" nolabel="1" /> |
673 | 49 | </page> | 44 | </page> |
674 | 50 | <!-- <page string="Store Views"> | 45 | <!-- <page string="Store Views"> |
675 | 51 | <field name="storeviews" nolabel="1" /> | 46 | <field name="storeviews" nolabel="1" /> |
676 | 52 | </page> | 47 | </page> |
677 | 53 | <page string="Groups (Stores)"> | 48 | <page string="Groups (Stores)"> |
678 | 54 | <field name="shop_ids" nolabel="1" /> | 49 | <field name="shop_ids" nolabel="1" /> |
679 | 55 | </page>--> | 50 | </page>--> |
680 | 56 | <page string="Product Attributes / Sets"> | 51 | <page string="Product Attributes / Sets" attrs="{'invisible': [['type_name', '!=', 'Magento']]}"> |
681 | 57 | <newline /> | 52 | <newline /> |
682 | 58 | <field name="attribute_sets" nolabel="1" colspan="4"/> | 53 | <field name="attribute_sets" nolabel="1" colspan="4"/> |
683 | 59 | </page> | 54 | </page> |
684 | 60 | <page string="Advanced"> | 55 | <page string="Advanced" attrs="{'invisible': [['type_name', '!=', 'Magento']]}"> |
685 | 61 | <separator string="Partner" colspan="4"/> | 56 | <separator string="Partner" colspan="4"/> |
686 | 62 | <group colspan="2" col="12"> | 57 | <group colspan="2" col="12"> |
688 | 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" /> |
689 | 64 | <field name="last_imported_partner_id" string=""/> | 59 | <field name="last_imported_partner_id" string=""/> |
690 | 65 | </group> | 60 | </group> |
693 | 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" /> |
694 | 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" /> |
695 | 68 | <separator string="Others" colspan="4"/> | 63 | <separator string="Others" colspan="4"/> |
696 | 69 | <field name="active" select="2"/> | 64 | <field name="active" select="2"/> |
799 | 70 | </page> | 65 | </page> |
800 | 71 | </xpath> | 66 | </notebook> |
801 | 72 | </field> | 67 | </field> |
802 | 73 | </record> | 68 | </record> |
803 | 74 | <record id="act_magerp_instances_form" model="ir.actions.act_window"> | 69 | <record id="act_magerp_instances_form" model="ir.actions.act_window"> |
804 | 75 | <field name="name">Magento Instances</field> | 70 | <field name="name">Magento Instances</field> |
805 | 76 | <field name="res_model">external.referential</field> | 71 | <field name="res_model">external.referential</field> |
806 | 77 | <field name="type">ir.actions.act_window</field> | 72 | <field name="type">ir.actions.act_window</field> |
807 | 78 | <field name="view_type">form</field> | 73 | <field name="view_type">form</field> |
808 | 79 | <field name="view_mode">tree,form</field> | 74 | <field name="view_mode">tree,form</field> |
809 | 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" /> |
810 | 81 | </record> | 76 | <field name="domain">[['type_name', '=', 'Magento']]</field> |
811 | 82 | 77 | </record> | |
812 | 83 | <!--Magento Websites Tree/Form view --> | 78 | |
813 | 84 | <record model="ir.ui.view" id="magerp_websites_form"> | 79 | <!--Magento Websites Tree/Form view --> |
814 | 85 | <field name="name">external.shop.group.form</field> | 80 | <record model="ir.ui.view" id="magerp_websites_form"> |
815 | 86 | <field name="model">external.shop.group</field> | 81 | <field name="name">external.shop.group.form</field> |
816 | 87 | <field name="type">form</field> | 82 | <field name="model">external.shop.group</field> |
817 | 88 | <field name="arch" type="xml"> | 83 | <field name="type">form</field> |
818 | 89 | <form string="Magento websites"> | 84 | <field name="arch" type="xml"> |
819 | 90 | <group col="4" colspan="4"> | 85 | <form string="Magento websites"> |
820 | 91 | <field name="name" readonly="1" /> | 86 | <group col="4" colspan="4"> |
821 | 92 | <field name="code" readonly="1" /> | 87 | <field name="name" readonly="1" /> |
822 | 93 | <field name="is_default" readonly="1" /> | 88 | <field name="code" readonly="1" /> |
823 | 94 | <field name="sort_order" readonly="1" /> | 89 | <field name="is_default" readonly="1" /> |
824 | 95 | <field name="default_shop_id" readonly="1" /> | 90 | <field name="sort_order" readonly="1" /> |
825 | 96 | <field name="referential_id" readonly="1" /> | 91 | <field name="default_shop_id" readonly="1" /> |
826 | 97 | </group> | 92 | <field name="referential_id" readonly="1" /> |
827 | 98 | <group col="4" colspan="4"> | 93 | </group> |
828 | 99 | <field name="shop_ids" readonly="1"/> | 94 | <group col="4" colspan="4"> |
829 | 100 | </group> | 95 | <field name="shop_ids" readonly="1"/> |
830 | 101 | </form> | 96 | </group> |
831 | 102 | </field> | 97 | </form> |
832 | 103 | </record> | 98 | </field> |
833 | 104 | <record model="ir.ui.view" id="magerp_websites_tree"> | 99 | </record> |
834 | 105 | <field name="name">external.shop.group.tree</field> | 100 | <record model="ir.ui.view" id="magerp_websites_tree"> |
835 | 106 | <field name="model">external.shop.group</field> | 101 | <field name="name">external.shop.group.tree</field> |
836 | 107 | <field name="type">tree</field> | 102 | <field name="model">external.shop.group</field> |
837 | 108 | <field name="arch" type="xml"> | 103 | <field name="type">tree</field> |
838 | 109 | <tree string="Magento websites"> | 104 | <field name="arch" type="xml"> |
839 | 110 | <field name="name" readonly="1" select="1" /> | 105 | <tree string="Magento websites"> |
840 | 111 | <field name="code" readonly="1" select="1" /> | 106 | <field name="name" readonly="1" select="1" /> |
841 | 112 | <field name="is_default" readonly="1" select="2" /> | 107 | <field name="code" readonly="1" select="1" /> |
842 | 113 | <field name="sort_order" readonly="1" select="2" /> | 108 | <field name="is_default" readonly="1" select="2" /> |
843 | 114 | <field name="default_shop_id" readonly="1" select="2" /> | 109 | <field name="sort_order" readonly="1" select="2" /> |
844 | 115 | <field name="shop_ids" readonly="1" /> | 110 | <field name="default_shop_id" readonly="1" select="2" /> |
845 | 116 | </tree> | 111 | <field name="shop_ids" readonly="1" /> |
846 | 117 | </field> | 112 | </tree> |
847 | 118 | </record> | 113 | </field> |
848 | 119 | <record id="act_magerp_websites_form" model="ir.actions.act_window"> | 114 | </record> |
849 | 120 | <field name="name">Magento websites</field> | 115 | <record id="act_magerp_websites_form" model="ir.actions.act_window"> |
850 | 121 | <field name="res_model">external.shop.group</field> | 116 | <field name="name">Magento websites</field> |
851 | 122 | <field name="type">ir.actions.act_window</field> | 117 | <field name="res_model">external.shop.group</field> |
852 | 123 | <field name="view_type">form</field> | 118 | <field name="type">ir.actions.act_window</field> |
853 | 124 | <field name="view_mode">tree,form</field> | 119 | <field name="view_type">form</field> |
854 | 125 | <field name="view_id" ref="magerp_websites_tree" /> | 120 | <field name="view_mode">tree,form</field> |
855 | 126 | </record> | 121 | <field name="view_id" ref="magerp_websites_tree" /> |
856 | 127 | 122 | </record> | |
857 | 128 | <!--Magento storeviews Tree/Form view --> | 123 | |
858 | 129 | <record model="ir.ui.view" id="magerp_storeviews_form"> | 124 | <!--Magento storeviews Tree/Form view --> |
859 | 130 | <field name="name">magerp.storeviews.form</field> | 125 | <record model="ir.ui.view" id="magerp_storeviews_form"> |
860 | 131 | <field name="model">magerp.storeviews</field> | 126 | <field name="name">magerp.storeviews.form</field> |
861 | 132 | <field name="type">form</field> | 127 | <field name="model">magerp.storeviews</field> |
862 | 133 | <field name="arch" type="xml"> | 128 | <field name="type">form</field> |
863 | 134 | <form string="Magento storeviews"> | 129 | <field name="arch" type="xml"> |
864 | 135 | <group col="4" colspan="4"> | 130 | <form string="Magento storeviews"> |
865 | 136 | <field name="name" readonly="1" /> | 131 | <group col="4" colspan="4"> |
866 | 137 | <field name="code" readonly="1" /> | 132 | <field name="name" readonly="1" /> |
867 | 138 | <field name="shop_id" readonly="1" /> | 133 | <field name="code" readonly="1" /> |
868 | 139 | <field name="website_id" readonly="1" /> | 134 | <field name="shop_id" readonly="1" /> |
869 | 140 | <field name="is_active" readonly="1" /> | 135 | <field name="website_id" readonly="1" /> |
870 | 141 | <field name="sort_order" readonly="1" /> | 136 | <field name="is_active" readonly="1" /> |
871 | 142 | <field name="lang_id" /> | 137 | <field name="sort_order" readonly="1" /> |
872 | 143 | </group> | 138 | <field name="lang_id" /> |
873 | 144 | </form> | 139 | </group> |
874 | 145 | </field> | 140 | </form> |
875 | 146 | </record> | 141 | </field> |
876 | 147 | <record model="ir.ui.view" id="magerp_storeviews_tree"> | 142 | </record> |
877 | 148 | <field name="name">magerp.storeviews.tree</field> | 143 | <record model="ir.ui.view" id="magerp_storeviews_tree"> |
878 | 149 | <field name="model">magerp.storeviews</field> | 144 | <field name="name">magerp.storeviews.tree</field> |
879 | 150 | <field name="type">tree</field> | 145 | <field name="model">magerp.storeviews</field> |
880 | 151 | <field name="arch" type="xml"> | 146 | <field name="type">tree</field> |
881 | 152 | <tree string="Magento storeviews"> | 147 | <field name="arch" type="xml"> |
882 | 153 | <field name="name" readonly="1" select="1" /> | 148 | <tree string="Magento storeviews"> |
883 | 154 | <field name="code" readonly="1" select="1" /> | 149 | <field name="name" readonly="1" select="1" /> |
884 | 155 | <field name="shop_id" readonly="1" select="1" /> | 150 | <field name="code" readonly="1" select="1" /> |
885 | 156 | <field name="is_active" readonly="1" select="2" /> | 151 | <field name="shop_id" readonly="1" select="1" /> |
886 | 157 | <field name="sort_order" readonly="1" select="2" /> | 152 | <field name="is_active" readonly="1" select="2" /> |
887 | 158 | <field name="lang_id" /> | 153 | <field name="sort_order" readonly="1" select="2" /> |
888 | 159 | </tree> | 154 | <field name="lang_id" /> |
889 | 160 | </field> | 155 | </tree> |
890 | 161 | </record> | 156 | </field> |
891 | 162 | <record id="act_magerp_storeviews_form" model="ir.actions.act_window"> | 157 | </record> |
892 | 163 | <field name="name">Magento storeviews</field> | 158 | <record id="act_magerp_storeviews_form" model="ir.actions.act_window"> |
893 | 164 | <field name="res_model">magerp.storeviews</field> | 159 | <field name="name">Magento storeviews</field> |
894 | 165 | <field name="type">ir.actions.act_window</field> | 160 | <field name="res_model">magerp.storeviews</field> |
895 | 166 | <field name="view_type">form</field> | 161 | <field name="type">ir.actions.act_window</field> |
896 | 167 | <field name="view_mode">tree,form</field> | 162 | <field name="view_type">form</field> |
897 | 168 | <field name="view_id" ref="magerp_storeviews_tree" /> | 163 | <field name="view_mode">tree,form</field> |
898 | 169 | </record> | 164 | <field name="view_id" ref="magerp_storeviews_tree" /> |
899 | 170 | 165 | </record> | |
900 | 171 | </data> | 166 | |
901 | 167 | </data> | ||
902 | 172 | </openerp> | 168 | </openerp> |
903 | 173 | 169 | ||
904 | === modified file 'magentoerpconnect/magerp_data.xml' | |||
905 | --- magentoerpconnect/magerp_data.xml 2012-06-21 17:33:57 +0000 | |||
906 | +++ magentoerpconnect/magerp_data.xml 2012-12-03 15:22:20 +0000 | |||
907 | @@ -1,7 +1,7 @@ | |||
908 | 1 | <?xml version="1.0"?> | 1 | <?xml version="1.0"?> |
909 | 2 | <openerp> | 2 | <openerp> |
912 | 3 | <data noupdate="1"> | 3 | <data noupdate="1"> |
913 | 4 | 4 | ||
914 | 5 | 5 | ||
915 | 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"> |
916 | 7 | <field name="name">Magento Import Orders</field> | 7 | <field name="name">Magento Import Orders</field> |
917 | @@ -122,15 +122,15 @@ | |||
918 | 122 | <!-- | 122 | <!-- |
919 | 123 | 123 | ||
920 | 124 | <record id="payment_type1" model="base.sale.payment.type"> | 124 | <record id="payment_type1" model="base.sale.payment.type"> |
925 | 125 | <field name="name">checkmo;cashondelivery</field> | 125 | <field name="name">checkmo;cashondelivery</field> |
926 | 126 | <field name="order_policy">manual</field> | 126 | <field name="order_policy">manual</field> |
927 | 127 | </record> | 127 | </record> |
928 | 128 | 128 | ||
929 | 129 | <record id="payment_type2" model="base.sale.payment.type"> | 129 | <record id="payment_type2" model="base.sale.payment.type"> |
933 | 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> |
934 | 131 | <field name="order_policy">prepaid</field> | 131 | <field name="order_policy">prepaid</field> |
935 | 132 | </record> | 132 | </record> |
936 | 133 | 133 | ||
937 | 134 | --> | 134 | --> |
939 | 135 | </data> | 135 | </data> |
940 | 136 | </openerp> | 136 | </openerp> |
941 | 137 | 137 | ||
942 | === modified file 'magentoerpconnect/magerp_menu.xml' | |||
943 | --- magentoerpconnect/magerp_menu.xml 2012-07-13 11:39:38 +0000 | |||
944 | +++ magentoerpconnect/magerp_menu.xml 2012-12-03 15:22:20 +0000 | |||
945 | @@ -2,7 +2,7 @@ | |||
946 | 2 | <openerp> | 2 | <openerp> |
947 | 3 | <data> | 3 | <data> |
948 | 4 | <menuitem id="menu_magerp" name="MagentoERPconnect" icon="terp-sale" | 4 | <menuitem id="menu_magerp" name="MagentoERPconnect" icon="terp-sale" |
950 | 5 | web_icon="images/magento.png" | 5 | web_icon="images/magento.png" |
951 | 6 | web_icon_hover="images/magento-hover.png"/> | 6 | web_icon_hover="images/magento-hover.png"/> |
952 | 7 | 7 | ||
953 | 8 | <menuitem id="menu_magerp_core" name="Core Settings" parent="menu_magerp" /> | 8 | <menuitem id="menu_magerp_core" name="Core Settings" parent="menu_magerp" /> |
954 | 9 | 9 | ||
955 | === modified file 'magentoerpconnect/magerp_osv.py' | |||
956 | --- magentoerpconnect/magerp_osv.py 2012-05-24 20:52:38 +0000 | |||
957 | +++ magentoerpconnect/magerp_osv.py 2012-12-03 15:22:20 +0000 | |||
958 | @@ -21,7 +21,6 @@ | |||
959 | 21 | ######################################################################### | 21 | ######################################################################### |
960 | 22 | 22 | ||
961 | 23 | import time | 23 | import time |
962 | 24 | import datetime | ||
963 | 25 | import xmlrpclib | 24 | import xmlrpclib |
964 | 26 | import urllib2 | 25 | import urllib2 |
965 | 27 | import base64 | 26 | import base64 |
966 | @@ -30,7 +29,9 @@ | |||
967 | 30 | 29 | ||
968 | 31 | #NEW FEATURE | 30 | #NEW FEATURE |
969 | 32 | 31 | ||
971 | 33 | from osv import osv, fields | 32 | from openerp.osv.orm import Model |
972 | 33 | from openerp.osv.osv import except_osv | ||
973 | 34 | from openerp import tools | ||
974 | 34 | from base_external_referentials.decorator import only_for_referential | 35 | from base_external_referentials.decorator import only_for_referential |
975 | 35 | from base_external_referentials.decorator import open_report | 36 | from base_external_referentials.decorator import open_report |
976 | 36 | from base_external_referentials.decorator import catch_error_in_report | 37 | from base_external_referentials.decorator import catch_error_in_report |
977 | @@ -38,42 +39,42 @@ | |||
978 | 38 | import logging | 39 | import logging |
979 | 39 | _logger = logging.getLogger(__name__) | 40 | _logger = logging.getLogger(__name__) |
980 | 40 | 41 | ||
982 | 41 | osv.osv.mag_transform_and_send_one_resource = osv.osv._transform_and_send_one_resource | 42 | Model.mag_transform_and_send_one_resource = Model._transform_and_send_one_resource |
983 | 42 | 43 | ||
985 | 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) |
986 | 44 | @catch_error_in_report | 45 | @catch_error_in_report |
987 | 45 | def _transform_and_send_one_resource(self, cr, uid, external_session, *args, **kwargs): | 46 | def _transform_and_send_one_resource(self, cr, uid, external_session, *args, **kwargs): |
988 | 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) |
989 | 47 | 48 | ||
996 | 48 | osv.osv._transform_and_send_one_resource = _transform_and_send_one_resource | 49 | Model._transform_and_send_one_resource = _transform_and_send_one_resource |
997 | 49 | 50 | ||
998 | 50 | 51 | ||
999 | 51 | osv.osv.mag_export_resources = osv.osv._export_resources | 52 | Model.mag_export_resources = Model._export_resources |
1000 | 52 | 53 | ||
1001 | 53 | @only_for_referential('magento', super_function = osv.osv.mag_export_resources) | 54 | @only_for_referential('magento', super_function = Model.mag_export_resources) |
1002 | 54 | @open_report | 55 | @open_report |
1003 | 55 | def _export_resources(self, *args, **kwargs): | 56 | def _export_resources(self, *args, **kwargs): |
1004 | 56 | return self.mag_export_resources( *args, **kwargs) | 57 | return self.mag_export_resources( *args, **kwargs) |
1011 | 57 | osv.osv._export_resources = _export_resources | 58 | Model._export_resources = _export_resources |
1012 | 58 | 59 | ||
1013 | 59 | 60 | ||
1014 | 60 | osv.osv._mag_get_external_resource_ids = osv.osv._get_external_resource_ids | 61 | Model._mag_get_external_resource_ids = Model._get_external_resource_ids |
1015 | 61 | 62 | ||
1016 | 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) |
1017 | 63 | def _get_external_resource_ids(self, cr, uid, external_session, resource_filter=None, mapping=None, mapping_id=None, context=None): | 64 | def _get_external_resource_ids(self, cr, uid, external_session, resource_filter=None, mapping=None, mapping_id=None, context=None): |
1018 | 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) |
1019 | 65 | ext_resource = mapping[mapping_id]['external_resource_name'] | 66 | ext_resource = mapping[mapping_id]['external_resource_name'] |
1020 | 66 | search_method = mapping[mapping_id]['external_search_method'] | 67 | search_method = mapping[mapping_id]['external_search_method'] |
1021 | 67 | if not search_method: | 68 | if not search_method: |
1024 | 68 | #TODO don't forget to replace model by nam ewhen name will be implemented | 69 | #TODO don't forget to replace model by name when name will be implemented |
1025 | 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'],)) |
1026 | 70 | return external_session.connection.call(search_method, [resource_filter]) | 71 | return external_session.connection.call(search_method, [resource_filter]) |
1027 | 71 | 72 | ||
1033 | 72 | osv.osv._get_external_resource_ids = _get_external_resource_ids | 73 | Model._get_external_resource_ids = _get_external_resource_ids |
1034 | 73 | 74 | ||
1035 | 74 | osv.osv._mag_get_external_resources = osv.osv._get_external_resources | 75 | Model._mag_get_external_resources = Model._get_external_resources |
1036 | 75 | 76 | ||
1037 | 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) |
1038 | 77 | def _get_external_resources(self, cr, uid, external_session, external_id=None, resource_filter=None, mapping=None, mapping_id=None, fields=None, context=None): | 78 | def _get_external_resources(self, cr, uid, external_session, external_id=None, resource_filter=None, mapping=None, mapping_id=None, fields=None, context=None): |
1039 | 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) |
1040 | 79 | ext_resource = mapping[mapping_id]['external_resource_name'] | 80 | ext_resource = mapping[mapping_id]['external_resource_name'] |
1041 | @@ -81,7 +82,7 @@ | |||
1042 | 81 | read_method = mapping[mapping_id]['external_get_method'] | 82 | read_method = mapping[mapping_id]['external_get_method'] |
1043 | 82 | if not read_method: | 83 | if not read_method: |
1044 | 83 | #TODO don't forget to replace model by nam ewhen name will be implemented | 84 | #TODO don't forget to replace model by nam ewhen name will be implemented |
1046 | 84 | raise osv.except_osv(_('User Error'), | 85 | raise except_osv(_('User Error'), |
1047 | 85 | _('There is no "Get Method" configured on the mapping %s') % | 86 | _('There is no "Get Method" configured on the mapping %s') % |
1048 | 86 | mapping[mapping_id]['model']) | 87 | mapping[mapping_id]['model']) |
1049 | 87 | return external_session.connection.call(read_method, [external_id]) | 88 | return external_session.connection.call(read_method, [external_id]) |
1050 | @@ -89,16 +90,16 @@ | |||
1051 | 89 | search_read_method = mapping[mapping_id]['external_list_method'] | 90 | search_read_method = mapping[mapping_id]['external_list_method'] |
1052 | 90 | if not search_read_method: | 91 | if not search_read_method: |
1053 | 91 | #TODO don't forget to replace model by nam ewhen name will be implemented | 92 | #TODO don't forget to replace model by nam ewhen name will be implemented |
1055 | 92 | raise osv.except_osv(_('User Error'), | 93 | raise except_osv(_('User Error'), |
1056 | 93 | _('There is no "List Method" configured on the mapping %s') % | 94 | _('There is no "List Method" configured on the mapping %s') % |
1057 | 94 | mapping[mapping_id]['model']) | 95 | mapping[mapping_id]['model']) |
1058 | 95 | return external_session.connection.call(search_read_method, [resource_filter or {}]) | 96 | return external_session.connection.call(search_read_method, [resource_filter or {}]) |
1059 | 96 | 97 | ||
1065 | 97 | osv.osv._get_external_resources = _get_external_resources | 98 | Model._get_external_resources = _get_external_resources |
1066 | 98 | 99 | ||
1067 | 99 | osv.osv._mag_ext_create = osv.osv.ext_create | 100 | Model._mag_ext_create = Model.ext_create |
1068 | 100 | 101 | ||
1069 | 101 | @only_for_referential('magento', super_function = osv.osv._mag_ext_create) | 102 | @only_for_referential('magento', super_function = Model._mag_ext_create) |
1070 | 102 | def ext_create(self, cr, uid, external_session, resources, mapping, mapping_id, context=None): | 103 | def ext_create(self, cr, uid, external_session, resources, mapping, mapping_id, context=None): |
1071 | 103 | ext_create_ids = {} | 104 | ext_create_ids = {} |
1072 | 104 | main_lang = context['main_lang'] | 105 | main_lang = context['main_lang'] |
1073 | @@ -107,11 +108,11 @@ | |||
1074 | 107 | ext_create_ids[resource_id] = ext_id | 108 | ext_create_ids[resource_id] = ext_id |
1075 | 108 | return ext_create_ids | 109 | return ext_create_ids |
1076 | 109 | 110 | ||
1082 | 110 | osv.osv.ext_create = ext_create | 111 | Model.ext_create = ext_create |
1083 | 111 | 112 | ||
1084 | 112 | 113 | ||
1085 | 113 | osv.osv._mag_ext_update= osv.osv.ext_update | 114 | Model._mag_ext_update= Model.ext_update |
1086 | 114 | @only_for_referential('magento', super_function = osv.osv._mag_ext_update) | 115 | @only_for_referential('magento', super_function = Model._mag_ext_update) |
1087 | 115 | def ext_update(self, cr, uid, external_session, resources, mapping=None, mapping_id=None, context=None): | 116 | def ext_update(self, cr, uid, external_session, resources, mapping=None, mapping_id=None, context=None): |
1088 | 116 | if not mapping[mapping_id]['external_update_method']: | 117 | if not mapping[mapping_id]['external_update_method']: |
1089 | 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']) |
1090 | @@ -124,9 +125,9 @@ | |||
1091 | 124 | [ext_id, resource[main_lang]]) | 125 | [ext_id, resource[main_lang]]) |
1092 | 125 | return True | 126 | return True |
1093 | 126 | 127 | ||
1095 | 127 | osv.osv.ext_update = ext_update | 128 | Model.ext_update = ext_update |
1096 | 128 | 129 | ||
1098 | 129 | #@only_for_referential('magento', super_function = osv.osv.send_to_external) | 130 | #@only_for_referential('magento', super_function = Model.send_to_external) |
1099 | 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): |
1100 | 131 | # print 'send this data to the external system', update_date | 132 | # print 'send this data to the external system', update_date |
1101 | 132 | # print 'data', resource | 133 | # print 'data', resource |
1102 | @@ -134,14 +135,14 @@ | |||
1103 | 134 | # import pdb; pdb.set_trace() | 135 | # import pdb; pdb.set_trace() |
1104 | 135 | # return True | 136 | # return True |
1105 | 136 | 137 | ||
1112 | 137 | #osv.osv.send_to_external = send_to_external | 138 | #Model.send_to_external = send_to_external |
1113 | 138 | 139 | ||
1114 | 139 | 140 | ||
1115 | 140 | #osv.osv.ori_mag_init_context_before_exporting_resource = osv.osv.init_context_before_exporting_resource | 141 | #Model.ori_mag_init_context_before_exporting_resource = Model.init_context_before_exporting_resource |
1116 | 141 | 142 | ||
1117 | 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) |
1118 | 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): |
1120 | 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) |
1121 | 145 | # if self._name == 'external.referential': | 146 | # if self._name == 'external.referential': |
1122 | 146 | # referential = self.browse(cr, uid, object_id, context=context) | 147 | # referential = self.browse(cr, uid, object_id, context=context) |
1123 | 147 | # elif 'referential_id' in self._columns.keys(): | 148 | # elif 'referential_id' in self._columns.keys(): |
1124 | @@ -155,7 +156,7 @@ | |||
1125 | 155 | # context['store_to_lang'][storeview.id] = storeview.lang_id.code | 156 | # context['store_to_lang'][storeview.id] = storeview.lang_id.code |
1126 | 156 | # return context | 157 | # return context |
1127 | 157 | 158 | ||
1129 | 158 | #osv.osv.init_context_before_exporting_resource = osv.osv.init_context_before_exporting_resource | 159 | #Model.init_context_before_exporting_resource = Model.init_context_before_exporting_resource |
1130 | 159 | 160 | ||
1131 | 160 | 161 | ||
1132 | 161 | def ext_set_resource_as_imported(self, cr, uid, external_session, external_id, mapping=None, mapping_id=None, context=None): | 162 | def ext_set_resource_as_imported(self, cr, uid, external_session, external_id, mapping=None, mapping_id=None, context=None): |
1133 | @@ -165,7 +166,7 @@ | |||
1134 | 165 | return external_session.connection.call(done_method, [external_id]) | 166 | return external_session.connection.call(done_method, [external_id]) |
1135 | 166 | return False | 167 | return False |
1136 | 167 | 168 | ||
1138 | 168 | osv.osv.ext_set_resource_as_imported = ext_set_resource_as_imported | 169 | Model.ext_set_resource_as_imported = ext_set_resource_as_imported |
1139 | 169 | 170 | ||
1140 | 170 | #DEPRECATED FEATURE!! YES ALL FUNCTION UNDER HIS LINE ARE DEPRECATED | 171 | #DEPRECATED FEATURE!! YES ALL FUNCTION UNDER HIS LINE ARE DEPRECATED |
1141 | 171 | 172 | ||
1142 | @@ -175,7 +176,7 @@ | |||
1143 | 175 | def __init__(self, location, username, password, debug=False, logger=False): | 176 | def __init__(self, location, username, password, debug=False, logger=False): |
1144 | 176 | #Append / if not there | 177 | #Append / if not there |
1145 | 177 | if not location[-1] == '/': | 178 | if not location[-1] == '/': |
1147 | 178 | location += '/' | 179 | location += '/' |
1148 | 179 | self.corelocation = location | 180 | self.corelocation = location |
1149 | 180 | #Please do not remove the str indeed xmlrpc lib require a string for the location | 181 | #Please do not remove the str indeed xmlrpc lib require a string for the location |
1150 | 181 | #if an unicode is send it will raise you an error | 182 | #if an unicode is send it will raise you an error |
1151 | @@ -186,7 +187,7 @@ | |||
1152 | 186 | self.result = {} | 187 | self.result = {} |
1153 | 187 | self.logger = logger or _logger | 188 | self.logger = logger or _logger |
1154 | 188 | 189 | ||
1156 | 189 | 190 | ||
1157 | 190 | def connect(self): | 191 | def connect(self): |
1158 | 191 | if not self.location[-1] == '/': | 192 | if not self.location[-1] == '/': |
1159 | 192 | self.location += '/' | 193 | self.location += '/' |
1160 | @@ -206,11 +207,11 @@ | |||
1161 | 206 | except Exception,e: | 207 | except Exception,e: |
1162 | 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) |
1163 | 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) |
1169 | 209 | time.sleep(sleep_time) | 210 | time.sleep(sleep_time) |
1170 | 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?')) |
1171 | 211 | 212 | ||
1172 | 212 | 213 | ||
1173 | 213 | def call(self, method, *arguments): | 214 | def call(self, method, *arguments): |
1174 | 214 | if arguments: | 215 | if arguments: |
1175 | 215 | arguments = list(arguments)[0] | 216 | arguments = list(arguments)[0] |
1176 | 216 | else: | 217 | else: |
1177 | @@ -242,7 +243,7 @@ | |||
1178 | 242 | except Exception, e: | 243 | except Exception, e: |
1179 | 243 | pass | 244 | pass |
1180 | 244 | 245 | ||
1182 | 245 | class magerp_osv(osv.osv): | 246 | class MagerpModel(Model): |
1183 | 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. |
1184 | 247 | 248 | ||
1185 | 248 | _MAGE_FIELD = 'magento_id' | 249 | _MAGE_FIELD = 'magento_id' |
1186 | @@ -254,7 +255,7 @@ | |||
1187 | 254 | _DELETE_METHOD = False | 255 | _DELETE_METHOD = False |
1188 | 255 | _mapping = {} | 256 | _mapping = {} |
1189 | 256 | DEBUG = False | 257 | DEBUG = False |
1191 | 257 | 258 | ||
1192 | 258 | #TODO deprecated, remove use | 259 | #TODO deprecated, remove use |
1193 | 259 | def mage_to_oe(self, cr, uid, mageid, instance, *arguments): | 260 | def mage_to_oe(self, cr, uid, mageid, instance, *arguments): |
1194 | 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""" |
1195 | @@ -279,7 +280,7 @@ | |||
1196 | 279 | read = self.read(cr, uid, oeid, [self._rec_name]) | 280 | read = self.read(cr, uid, oeid, [self._rec_name]) |
1197 | 280 | return (read[0]['id'], read[0][self._rec_name]) | 281 | return (read[0]['id'], read[0][self._rec_name]) |
1198 | 281 | return False | 282 | return False |
1200 | 282 | 283 | ||
1201 | 283 | #TODO deprecated, remove use | 284 | #TODO deprecated, remove use |
1202 | 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): |
1203 | 285 | 286 | ||
1204 | @@ -314,7 +315,7 @@ | |||
1205 | 314 | 'temp_vars':{}, | 315 | 'temp_vars':{}, |
1206 | 315 | 'mage2oe_filters':mage2oe_filters | 316 | 'mage2oe_filters':mage2oe_filters |
1207 | 316 | } | 317 | } |
1209 | 317 | 318 | ||
1210 | 318 | #now properly mapp known Magento attributes to OpenERP entity columns: | 319 | #now properly mapp known Magento attributes to OpenERP entity columns: |
1211 | 319 | for each_valid_key in self._mapping: | 320 | for each_valid_key in self._mapping: |
1212 | 320 | if each_valid_key in magento_record.keys(): | 321 | if each_valid_key in magento_record.keys(): |
1213 | @@ -353,7 +354,7 @@ | |||
1214 | 353 | self.record_save(cr, uid, rec_id, vals, defaults) | 354 | self.record_save(cr, uid, rec_id, vals, defaults) |
1215 | 354 | else: | 355 | else: |
1216 | 355 | self.record_save(cr, uid, rec_id, vals, defaults) | 356 | self.record_save(cr, uid, rec_id, vals, defaults) |
1218 | 356 | 357 | ||
1219 | 357 | def record_save(self, cr, uid, rec_id, vals, defaults): | 358 | def record_save(self, cr, uid, rec_id, vals, defaults): |
1220 | 358 | if defaults: | 359 | if defaults: |
1221 | 359 | for key in defaults.keys(): | 360 | for key in defaults.keys(): |
1222 | @@ -364,7 +365,7 @@ | |||
1223 | 364 | else: | 365 | else: |
1224 | 365 | #Record is not there, create it | 366 | #Record is not there, create it |
1225 | 366 | self.create(cr, uid, vals,) | 367 | self.create(cr, uid, vals,) |
1227 | 367 | 368 | ||
1228 | 368 | def cast_string(self, subject): | 369 | def cast_string(self, subject): |
1229 | 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""" |
1230 | 370 | for key in subject.keys(): | 371 | for key in subject.keys(): |
1231 | @@ -374,7 +375,7 @@ | |||
1232 | 374 | else: | 375 | else: |
1233 | 375 | subject[key] = True | 376 | subject[key] = True |
1234 | 376 | return subject | 377 | return subject |
1236 | 377 | 378 | ||
1237 | 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): |
1238 | 379 | if context is None: | 380 | if context is None: |
1239 | 380 | context = {} | 381 | context = {} |
1240 | @@ -396,7 +397,7 @@ | |||
1241 | 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) |
1242 | 397 | if list_method: | 398 | if list_method: |
1243 | 398 | data = conn.call(list_method, context['ids_or_filter']) | 399 | data = conn.call(list_method, context['ids_or_filter']) |
1245 | 399 | 400 | ||
1246 | 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) |
1247 | 401 | if context.get('one_by_one', False): | 402 | if context.get('one_by_one', False): |
1248 | 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) |
1249 | @@ -437,8 +438,8 @@ | |||
1250 | 437 | else: | 438 | else: |
1251 | 438 | self.sync_import(cr, uid, magento_records, instance, debug, defaults) | 439 | self.sync_import(cr, uid, magento_records, instance, debug, defaults) |
1252 | 439 | else: | 440 | else: |
1255 | 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!")) |
1256 | 441 | 442 | ||
1257 | 442 | #TODO deprecated, remove use | 443 | #TODO deprecated, remove use |
1258 | 443 | def get_all_mage_ids(self, cr, uid, ids, instance=False): | 444 | def get_all_mage_ids(self, cr, uid, ids, instance=False): |
1259 | 444 | search_param = [] | 445 | search_param = [] |
1260 | @@ -451,4 +452,6 @@ | |||
1261 | 451 | for each in reads: | 452 | for each in reads: |
1262 | 452 | mageids.append(each[self._MAGE_FIELD]) | 453 | mageids.append(each[self._MAGE_FIELD]) |
1263 | 453 | return mageids | 454 | return mageids |
1265 | 454 | 455 | ||
1266 | 456 | # deprecated, bw compat | ||
1267 | 457 | magerp_osv = MagerpModel | ||
1268 | 455 | 458 | ||
1269 | === modified file 'magentoerpconnect/partner.py' | |||
1270 | --- magentoerpconnect/partner.py 2012-06-01 18:21:53 +0000 | |||
1271 | +++ magentoerpconnect/partner.py 2012-12-03 15:22:20 +0000 | |||
1272 | @@ -22,47 +22,51 @@ | |||
1273 | 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/>. # |
1274 | 23 | ######################################################################### | 23 | ######################################################################### |
1275 | 24 | 24 | ||
1279 | 25 | from osv import osv, fields | 25 | import hashlib |
1280 | 26 | from tools.translate import _ | 26 | |
1281 | 27 | import magerp_osv | 27 | from openerp.osv import fields |
1282 | 28 | from .magerp_osv import MagerpModel | ||
1283 | 28 | from base_external_referentials.decorator import only_for_referential | 29 | from base_external_referentials.decorator import only_for_referential |
1284 | 29 | import hashlib | ||
1285 | 30 | 30 | ||
1287 | 31 | class res_partner_category(magerp_osv.magerp_osv): | 31 | class res_partner_category(MagerpModel): |
1288 | 32 | _inherit = "res.partner.category" | 32 | _inherit = "res.partner.category" |
1292 | 33 | 33 | _columns = {'tax_class_id':fields.integer('Tax Class ID'), | |
1290 | 34 | _columns = { | ||
1291 | 35 | 'tax_class_id':fields.integer('Tax Class ID'), | ||
1293 | 36 | } | 34 | } |
1294 | 37 | res_partner_category() | ||
1295 | 38 | 35 | ||
1297 | 39 | class res_partner_address(magerp_osv.magerp_osv): | 36 | class res_partner_address(MagerpModel): |
1298 | 40 | _inherit = "res.partner.address" | 37 | _inherit = "res.partner.address" |
1299 | 41 | 38 | ||
1310 | 42 | 39 | #Migration script for 6.1.0 to 6.1.1 | |
1311 | 43 | #TODO maybe move the fields company, firstname, lastname in an extra module | 40 | def _auto_init(self, cr, context=None): |
1312 | 44 | #On v7 the partner address model will totaly change so maybe it's not worth | 41 | # recompute the field name with firstname + lastname |
1313 | 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 |
1314 | 46 | res ={} | 43 | first_install=False |
1315 | 47 | for partner in self.browse(cr, uid, ids, context=context): | 44 | cr.execute("SELECT column_name FROM information_schema.columns " |
1316 | 48 | res[partner.id] = ((partner.company and partner.company + ' : ') or '') + \ | 45 | "WHERE table_name = 'res_partner_address' " |
1317 | 49 | (partner.lastname and partner.lastname + ' ' or '') + \ | 46 | "AND column_name = 'firstname'") |
1318 | 50 | (partner.firstname or '') | 47 | if cr.fetchone(): |
1319 | 51 | return res | 48 | cr.execute( |
1320 | 49 | "UPDATE res_partner_address " | ||
1321 | 50 | "SET name = CASE " | ||
1322 | 51 | "WHEN firstname IS NOT NULL AND lastname IS NOT NULL THEN (firstname || ' ' || lastname) " | ||
1323 | 52 | "WHEN firstname IS NOT NULL AND lastname IS NULL THEN firstname " | ||
1324 | 53 | "WHEN firstname IS NULL AND lastname IS NOT NULL THEN lastname " | ||
1325 | 54 | "ELSE name " | ||
1326 | 55 | "END" | ||
1327 | 56 | ) | ||
1328 | 57 | cr.execute("ALTER TABLE res_partner_address " | ||
1329 | 58 | "RENAME COLUMN firstname TO first_name") | ||
1330 | 59 | cr.execute("ALTER TABLE res_partner_address " | ||
1331 | 60 | "RENAME COLUMN lastname TO last_name") | ||
1332 | 61 | return super(res_partner_address, self)._auto_init(cr, context=context) | ||
1333 | 52 | 62 | ||
1334 | 53 | _columns = { | 63 | _columns = { |
1335 | 54 | 'name': fields.function(_get_partner_name, obj="res.partner.address", type = 'char', size = 256, string='Name', | ||
1336 | 55 | store = { | ||
1337 | 56 | 'res.partner.address' : (lambda self, cr, uid, ids, c={}: ids, | ||
1338 | 57 | ['company', 'firstname', 'lastname'], 10)}), | ||
1339 | 58 | 'company':fields.char('Company', size=100), | 64 | 'company':fields.char('Company', size=100), |
1340 | 59 | 'firstname':fields.char('First Name', size=100), | ||
1341 | 60 | 'lastname':fields.char('Last Name', size=100), | ||
1342 | 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? |
1344 | 62 | } | 66 | } |
1345 | 63 | _defaults = { | 67 | _defaults = { |
1346 | 64 | 'is_magento_order_address': lambda * a:False, | 68 | 'is_magento_order_address': lambda * a:False, |
1348 | 65 | } | 69 | } |
1349 | 66 | 70 | ||
1350 | 67 | @only_for_referential('magento') | 71 | @only_for_referential('magento') |
1351 | 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): |
1352 | @@ -74,9 +78,7 @@ | |||
1353 | 74 | ext_create_ids[resource_id] = ext_id | 78 | ext_create_ids[resource_id] = ext_id |
1354 | 75 | return ext_create_ids | 79 | return ext_create_ids |
1355 | 76 | 80 | ||
1359 | 77 | res_partner_address() | 81 | class res_partner(MagerpModel): |
1357 | 78 | |||
1358 | 79 | class res_partner(magerp_osv.magerp_osv): | ||
1360 | 80 | _inherit = "res.partner" | 82 | _inherit = "res.partner" |
1361 | 81 | 83 | ||
1362 | 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): |
1363 | @@ -94,20 +96,20 @@ | |||
1364 | 94 | return res | 96 | return res |
1365 | 95 | 97 | ||
1366 | 96 | _columns = { | 98 | _columns = { |
1381 | 97 | 'group_id':fields.many2one('res.partner.category', 'Magento Group(Category)'), | 99 | 'group_id':fields.many2one('res.partner.category', 'Magento Group(Category)'), |
1382 | 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."), |
1383 | 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'), |
1384 | 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.'), |
1385 | 101 | 'created_in':fields.char('Created in', size=100), | 103 | 'created_in':fields.char('Created in', size=100), |
1386 | 102 | 'created_at':fields.datetime('Created Date'), | 104 | 'created_at':fields.datetime('Created Date'), |
1387 | 103 | 'updated_at':fields.datetime('Updated At'), | 105 | 'updated_at':fields.datetime('Updated At'), |
1388 | 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."), |
1389 | 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."), |
1390 | 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."), |
1391 | 107 | 'mag_newsletter':fields.boolean('Newsletter'), | 109 | 'mag_newsletter':fields.boolean('Newsletter'), |
1392 | 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"), |
1393 | 109 | 'magento_pwd': fields.char('Magento Password', size=256), | 111 | 'magento_pwd': fields.char('Magento Password', size=256), |
1394 | 110 | } | 112 | } |
1395 | 111 | 113 | ||
1396 | 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.')] |
1397 | 113 | 115 | ||
1398 | @@ -124,7 +126,7 @@ | |||
1399 | 124 | AND ir_model_data.model = 'res.partner' | 126 | AND ir_model_data.model = 'res.partner' |
1400 | 125 | AND ir_model_data.referential_id = %(ref_id)s | 127 | AND ir_model_data.referential_id = %(ref_id)s |
1401 | 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""" |
1403 | 127 | params = {'ref_id': external_session.referential_id.id, | 129 | params = {'ref_id': external_session.referential_id.id, |
1404 | 128 | 'store_ids': tuple(store_ids)} | 130 | 'store_ids': tuple(store_ids)} |
1405 | 129 | cr.execute(query,params) | 131 | cr.execute(query,params) |
1406 | 130 | results = cr.dictfetchall() | 132 | results = cr.dictfetchall() |
1407 | @@ -134,7 +136,7 @@ | |||
1408 | 134 | @only_for_referential('magento') | 136 | @only_for_referential('magento') |
1409 | 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, |
1410 | 136 | update_date, mapping, mapping_id, defaults=None, context=None): | 138 | update_date, mapping, mapping_id, defaults=None, context=None): |
1412 | 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, |
1413 | 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) |
1414 | 139 | if res: | 141 | if res: |
1415 | 140 | address_obj = self.pool.get('res.partner.address') | 142 | address_obj = self.pool.get('res.partner.address') |
1416 | @@ -142,5 +144,3 @@ | |||
1417 | 142 | for resource_id in resource_ids: | 144 | for resource_id in resource_ids: |
1418 | 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) |
1419 | 144 | return res | 146 | return res |
1420 | 145 | |||
1421 | 146 | res_partner() | ||
1422 | 147 | 147 | ||
1423 | === modified file 'magentoerpconnect/partner_view.xml' | |||
1424 | --- magentoerpconnect/partner_view.xml 2012-05-19 13:37:23 +0000 | |||
1425 | +++ magentoerpconnect/partner_view.xml 2012-12-03 15:22:20 +0000 | |||
1426 | @@ -7,10 +7,8 @@ | |||
1427 | 7 | <field name="type">form</field> | 7 | <field name="type">form</field> |
1428 | 8 | <field name="inherit_id" ref="base.view_partner_form" /> | 8 | <field name="inherit_id" ref="base.view_partner_form" /> |
1429 | 9 | <field name="arch" type="xml"> | 9 | <field name="arch" type="xml"> |
1431 | 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" > |
1432 | 11 | <field name="company" /> | 11 | <field name="company" /> |
1433 | 12 | <field name="firstname" /> | ||
1434 | 13 | <field name="lastname" /> | ||
1435 | 14 | </xpath> | 12 | </xpath> |
1436 | 15 | <xpath expr="/form/notebook" position="inside"> | 13 | <xpath expr="/form/notebook" position="inside"> |
1437 | 16 | <page string="Magento Information"> | 14 | <page string="Magento Information"> |
1438 | @@ -50,10 +48,8 @@ | |||
1439 | 50 | <field name="type">form</field> | 48 | <field name="type">form</field> |
1440 | 51 | <field name="inherit_id" ref="base.view_partner_address_form1" /> | 49 | <field name="inherit_id" ref="base.view_partner_address_form1" /> |
1441 | 52 | <field name="arch" type="xml"> | 50 | <field name="arch" type="xml"> |
1443 | 53 | <field name="name" position="replace"> | 51 | <field name="name" position="after"> |
1444 | 54 | <field name="company" /> | 52 | <field name="company" /> |
1445 | 55 | <field name="firstname" /> | ||
1446 | 56 | <field name="lastname" /> | ||
1447 | 57 | </field> | 53 | </field> |
1448 | 58 | </field> | 54 | </field> |
1449 | 59 | </record> | 55 | </record> |
1450 | 60 | 56 | ||
1451 | === modified file 'magentoerpconnect/product.py' | |||
1452 | --- magentoerpconnect/product.py 2012-08-14 15:46:07 +0000 | |||
1453 | +++ magentoerpconnect/product.py 2012-12-03 15:22:20 +0000 | |||
1454 | @@ -22,26 +22,27 @@ | |||
1455 | 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/>. # |
1456 | 23 | ######################################################################### | 23 | ######################################################################### |
1457 | 24 | 24 | ||
1458 | 25 | from osv import osv, orm, fields | ||
1459 | 26 | import datetime | ||
1460 | 27 | import time | 25 | import time |
1461 | 28 | import pooler | ||
1462 | 29 | import magerp_osv | ||
1463 | 30 | from tools.translate import _ | ||
1464 | 31 | import unicodedata | 26 | import unicodedata |
1465 | 32 | import base64, urllib | 27 | import base64, urllib |
1466 | 33 | import os | 28 | import os |
1467 | 29 | import xmlrpclib | ||
1468 | 34 | from lxml import etree | 30 | from lxml import etree |
1469 | 35 | import xmlrpclib | ||
1470 | 36 | |||
1471 | 37 | import logging | 31 | import logging |
1472 | 32 | |||
1473 | 33 | from openerp.osv.orm import Model, setup_modifiers | ||
1474 | 34 | from openerp.osv import fields | ||
1475 | 35 | from openerp.osv.osv import except_osv | ||
1476 | 36 | from openerp import pooler | ||
1477 | 37 | from openerp.tools.translate import _ | ||
1478 | 38 | from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT | ||
1479 | 39 | |||
1480 | 40 | from .magerp_osv import MagerpModel | ||
1481 | 41 | from base_external_referentials.decorator import only_for_referential, catch_error_in_report | ||
1482 | 42 | from base_external_referentials.external_osv import ExternalSession | ||
1483 | 43 | |||
1484 | 38 | _logger = logging.getLogger(__name__) | 44 | _logger = logging.getLogger(__name__) |
1485 | 39 | 45 | ||
1486 | 40 | from tools import DEFAULT_SERVER_DATETIME_FORMAT | ||
1487 | 41 | |||
1488 | 42 | from base_external_referentials.decorator import only_for_referential | ||
1489 | 43 | from base_external_referentials.external_osv import ExternalSession | ||
1490 | 44 | |||
1491 | 45 | #Enabling this to True will put all custom attributes into One page in | 46 | #Enabling this to True will put all custom attributes into One page in |
1492 | 46 | #the products view | 47 | #the products view |
1493 | 47 | GROUP_CUSTOM_ATTRS_TOGETHER = False | 48 | GROUP_CUSTOM_ATTRS_TOGETHER = False |
1494 | @@ -70,7 +71,7 @@ | |||
1495 | 70 | else: | 71 | else: |
1496 | 71 | return False | 72 | return False |
1497 | 72 | 73 | ||
1499 | 73 | class magerp_product_category_attribute_options(magerp_osv.magerp_osv): | 74 | class magerp_product_category_attribute_options(MagerpModel): |
1500 | 74 | _name = "magerp.product_category_attribute_options" | 75 | _name = "magerp.product_category_attribute_options" |
1501 | 75 | _description = "Option products category Attributes" | 76 | _description = "Option products category Attributes" |
1502 | 76 | _rec_name = "label" | 77 | _rec_name = "label" |
1503 | @@ -98,13 +99,10 @@ | |||
1504 | 98 | 'value':fields.char('Value', size=200), | 99 | 'value':fields.char('Value', size=200), |
1505 | 99 | #'ipcast':fields.char('Type cast', size=50), | 100 | #'ipcast':fields.char('Type cast', size=50), |
1506 | 100 | 'label':fields.char('Label', size=100), | 101 | 'label':fields.char('Label', size=100), |
1514 | 101 | } | 102 | } |
1515 | 102 | 103 | ||
1516 | 103 | 104 | ||
1517 | 104 | magerp_product_category_attribute_options() | 105 | class product_category(MagerpModel): |
1511 | 105 | |||
1512 | 106 | |||
1513 | 107 | class product_category(magerp_osv.magerp_osv): | ||
1518 | 108 | _inherit = "product.category" | 106 | _inherit = "product.category" |
1519 | 109 | 107 | ||
1520 | 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): |
1521 | @@ -152,16 +150,13 @@ | |||
1522 | 152 | parent_id = resource[main_lang]['parent_id'] | 150 | parent_id = resource[main_lang]['parent_id'] |
1523 | 153 | del resource[main_lang]['parent_id'] | 151 | del resource[main_lang]['parent_id'] |
1524 | 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]) |
1526 | 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]) |
1527 | 156 | for storeview, lang in storeview_to_lang.items(): | 154 | for storeview, lang in storeview_to_lang.items(): |
1528 | 157 | del resource[lang]['ext_id'] | 155 | del resource[lang]['ext_id'] |
1529 | 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]) |
1530 | 159 | ext_update_ids[resource_id] = ext_id | 157 | ext_update_ids[resource_id] = ext_id |
1531 | 160 | return ext_update_ids | 158 | return ext_update_ids |
1532 | 161 | 159 | ||
1533 | 162 | |||
1534 | 163 | |||
1535 | 164 | |||
1536 | 165 | _columns = { | 160 | _columns = { |
1537 | 166 | 'magerp_fields' : fields.serialized('Magento Product Categories Extra Fields'), | 161 | 'magerp_fields' : fields.serialized('Magento Product Categories Extra Fields'), |
1538 | 167 | 'create_date': fields.datetime('Created date', readonly=True), | 162 | 'create_date': fields.datetime('Created date', readonly=True), |
1539 | @@ -194,8 +189,6 @@ | |||
1540 | 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')]"), |
1541 | 195 | } | 190 | } |
1542 | 196 | 191 | ||
1543 | 197 | |||
1544 | 198 | |||
1545 | 199 | _defaults = { | 192 | _defaults = { |
1546 | 200 | 'display_mode':lambda * a:'PRODUCTS', | 193 | 'display_mode':lambda * a:'PRODUCTS', |
1547 | 201 | 'use_default_available_sort_by': lambda * a:True, | 194 | 'use_default_available_sort_by': lambda * a:True, |
1548 | @@ -203,7 +196,7 @@ | |||
1549 | 203 | 'level':lambda * a:1, | 196 | 'level':lambda * a:1, |
1550 | 204 | 'include_in_menu': lambda * a:True, | 197 | 'include_in_menu': lambda * a:True, |
1551 | 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), |
1553 | 206 | } | 199 | } |
1554 | 207 | 200 | ||
1555 | 208 | def write(self, cr, uid, ids, vals, context=None): | 201 | def write(self, cr, uid, ids, vals, context=None): |
1556 | 209 | if not 'magerp_stamp' in vals.keys(): | 202 | if not 'magerp_stamp' in vals.keys(): |
1557 | @@ -224,10 +217,8 @@ | |||
1558 | 224 | ids = get_child_ids(categ_tree) | 217 | ids = get_child_ids(categ_tree) |
1559 | 225 | return ids | 218 | return ids |
1560 | 226 | 219 | ||
1565 | 227 | product_category() | 220 | |
1566 | 228 | 221 | class magerp_product_attributes(MagerpModel): | |
1563 | 229 | |||
1564 | 230 | class magerp_product_attributes(magerp_osv.magerp_osv): | ||
1567 | 231 | _name = "magerp.product_attributes" | 222 | _name = "magerp.product_attributes" |
1568 | 232 | _description = "Attributes of products" | 223 | _description = "Attributes of products" |
1569 | 233 | _rec_name = "attribute_code" | 224 | _rec_name = "attribute_code" |
1570 | @@ -295,95 +286,84 @@ | |||
1571 | 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'), |
1572 | 296 | } | 287 | } |
1573 | 297 | 288 | ||
1578 | 298 | _defaults = { | 289 | _defaults = {'based_on': lambda*a: 'product_template', |
1579 | 299 | 'based_on': lambda*a: 'product_template', | 290 | } |
1576 | 300 | } | ||
1577 | 301 | |||
1580 | 302 | #mapping magentofield:(openerpfield,typecast,) | 291 | #mapping magentofield:(openerpfield,typecast,) |
1581 | 303 | #have an entry for each mapped field | 292 | #have an entry for each mapped field |
1665 | 304 | _no_create_list = [ | 293 | _no_create_list = ['product_id', |
1666 | 305 | 'product_id', | 294 | 'name', |
1667 | 306 | 'name', | 295 | 'description', |
1668 | 307 | 'description', | 296 | 'short_description', |
1669 | 308 | 'short_description', | 297 | 'sku', |
1670 | 309 | 'sku', | 298 | 'weight', |
1671 | 310 | 'weight', | 299 | 'category_ids', |
1672 | 311 | 'category_ids', | 300 | 'price', |
1673 | 312 | 'price', | 301 | 'cost', |
1674 | 313 | 'cost', | 302 | 'set', |
1675 | 314 | 'set', | 303 | 'ean', |
1676 | 315 | 'ean', | 304 | ] |
1677 | 316 | ] | 305 | _translatable_default_codes = ['description', |
1678 | 317 | 306 | 'meta_description', | |
1679 | 318 | _translatable_default_codes = [ | 307 | 'meta_keyword', |
1680 | 319 | 'description', | 308 | 'meta_title', |
1681 | 320 | 'meta_description', | 309 | 'name', |
1682 | 321 | 'meta_keyword', | 310 | 'short_description', |
1683 | 322 | 'meta_title', | 311 | 'url_key', |
1684 | 323 | 'name', | 312 | ] |
1685 | 324 | 'short_description', | 313 | _not_store_in_json = ['minimal_price', |
1686 | 325 | 'url_key', | 314 | 'special_price', |
1687 | 326 | ] | 315 | 'description', |
1688 | 327 | 316 | 'meta_description', | |
1689 | 328 | _not_store_in_json = [ | 317 | 'meta_keyword', |
1690 | 329 | 'minimal_price', | 318 | 'meta_title', |
1691 | 330 | 'special_price', | 319 | 'name', |
1692 | 331 | 'description', | 320 | 'short_description', |
1693 | 332 | 'meta_description', | 321 | 'url_key', |
1694 | 333 | 'meta_keyword', | 322 | ] |
1695 | 334 | 'meta_title', | 323 | _type_conversion = {'':'char', |
1696 | 335 | 'name', | 324 | 'text':'char', |
1697 | 336 | 'short_description', | 325 | 'textarea':'text', |
1698 | 337 | 'url_key', | 326 | 'select':'many2one', |
1699 | 338 | ] | 327 | 'date':'date', |
1700 | 339 | 328 | 'price':'float', | |
1701 | 340 | _type_conversion = { | 329 | 'media_image':'binary', |
1702 | 341 | '':'char', | 330 | 'gallery':'binary', |
1703 | 342 | 'text':'char', | 331 | 'multiselect':'many2many', |
1704 | 343 | 'textarea':'text', | 332 | 'boolean':'boolean', |
1705 | 344 | 'select':'many2one', | 333 | 'weee':'char', |
1706 | 345 | 'date':'date', | 334 | False:'char', |
1707 | 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 |
1708 | 347 | 'media_image':'binary', | 336 | } |
1709 | 348 | 'gallery':'binary', | 337 | _type_casts = {'':'unicode', |
1710 | 349 | 'multiselect':'many2many', | 338 | 'text':'unicode', |
1711 | 350 | 'boolean':'boolean', | 339 | 'textarea':'unicode', |
1712 | 351 | 'weee':'char', | 340 | 'select':'unicode', |
1713 | 352 | False:'char', | 341 | 'date':'unicode', |
1714 | 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 option | 342 | 'price':'float', |
1715 | 354 | } | 343 | 'media_image':'False', |
1716 | 355 | 344 | 'gallery':'False', | |
1717 | 356 | _type_casts = { | 345 | 'multiselect':'list', |
1718 | 357 | '':'unicode', | 346 | 'boolean':'int', |
1719 | 358 | 'text':'unicode', | 347 | 'weee':'unicode', |
1720 | 359 | 'textarea':'unicode', | 348 | False:'unicode', |
1721 | 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 |
1722 | 361 | 'date':'unicode', | 350 | } |
1723 | 362 | 'price':'float', | 351 | _variant_fields = ['color', |
1724 | 363 | 'media_image':'False', | 352 | 'dimension', |
1725 | 364 | 'gallery':'False', | 353 | 'visibility', |
1726 | 365 | 'multiselect':'list', | 354 | 'special_price', |
1727 | 366 | 'boolean':'int', | 355 | 'special_price_from_date', |
1728 | 367 | 'weee':'unicode', | 356 | 'special_price_to_date', |
1729 | 368 | False:'unicode', | 357 | ] |
1730 | 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 option | 358 | |
1731 | 370 | } | 359 | |
1732 | 371 | 360 | #For some field you can specify the syncronisation way | |
1733 | 372 | _variant_fields = [ | 361 | #in : Magento => OpenERP |
1734 | 373 | 'color', | 362 | #out : Magento <= OpenERP |
1735 | 374 | 'dimension', | 363 | #in_out (default_value) : Magento <=> OpenERP |
1736 | 375 | 'visibility', | 364 | _sync_way = {'has_options' : 'in', |
1737 | 376 | 'special_price', | 365 | 'tier_price': 'in', |
1738 | 377 | 'special_price_from_date', | 366 | } |
1656 | 378 | 'special_price_to_date', | ||
1657 | 379 | ] | ||
1658 | 380 | |||
1659 | 381 | |||
1660 | 382 | #TODO check if this field have to be in only one way and if yes add this feature | ||
1661 | 383 | _sync_way = { | ||
1662 | 384 | 'has_options' : 'in', | ||
1663 | 385 | 'special_price' : 'in', | ||
1664 | 386 | } | ||
1739 | 387 | 367 | ||
1740 | 388 | def _is_attribute_translatable(self, vals): | 368 | def _is_attribute_translatable(self, vals): |
1741 | 389 | """Tells if field associated to attribute should be translatable or not. | 369 | """Tells if field associated to attribute should be translatable or not. |
1742 | @@ -493,7 +473,6 @@ | |||
1743 | 493 | # mapping have to be based on product.product | 473 | # mapping have to be based on product.product |
1744 | 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] |
1745 | 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) |
1746 | 496 | |||
1747 | 497 | return crid | 476 | return crid |
1748 | 498 | 477 | ||
1749 | 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): |
1750 | @@ -557,17 +536,16 @@ | |||
1751 | 557 | mapping_line = {'external_field': vals['attribute_code'], | 536 | mapping_line = {'external_field': vals['attribute_code'], |
1752 | 558 | 'sequence': 0, | 537 | 'sequence': 0, |
1753 | 559 | 'mapping_id': mapping_id[0], | 538 | 'mapping_id': mapping_id[0], |
1755 | 560 | 'type': 'in_out', | 539 | 'type': self._sync_way.get(vals['attribute_code'], 'in_out'), |
1756 | 561 | 'external_type': self._type_casts[vals.get('frontend_input', False)], | 540 | 'external_type': self._type_casts[vals.get('frontend_input', False)], |
1757 | 562 | 'field_id': field_id, } | 541 | 'field_id': field_id, } |
1758 | 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) |
1759 | 564 | self.pool.get('external.mapping.line').create(cr, uid, mapping_line) | 543 | self.pool.get('external.mapping.line').create(cr, uid, mapping_line) |
1760 | 565 | return True | 544 | return True |
1761 | 566 | 545 | ||
1762 | 567 | magerp_product_attributes() | ||
1763 | 568 | 546 | ||
1764 | 569 | """Dont remove the code, we might need it --sharoon | 547 | """Dont remove the code, we might need it --sharoon |
1766 | 570 | class magerp_product_attributes_set_info(osv.osv): | 548 | class magerp_product_attributes_set_info(Model): |
1767 | 571 | _name="magerp.product_attributes.set_info" | 549 | _name="magerp.product_attributes.set_info" |
1768 | 572 | _description = "Attribute Set information for each attribute" | 550 | _description = "Attribute Set information for each attribute" |
1769 | 573 | _columns = { | 551 | _columns = { |
1770 | @@ -579,7 +557,7 @@ | |||
1771 | 579 | } | 557 | } |
1772 | 580 | magerp_product_attributes_set_info()""" | 558 | magerp_product_attributes_set_info()""" |
1773 | 581 | 559 | ||
1775 | 582 | class magerp_product_attribute_options(magerp_osv.magerp_osv): | 560 | class magerp_product_attribute_options(MagerpModel): |
1776 | 583 | _name = "magerp.product_attribute_options" | 561 | _name = "magerp.product_attribute_options" |
1777 | 584 | _description = "Options of selected attributes" | 562 | _description = "Options of selected attributes" |
1778 | 585 | _rec_name = "label" | 563 | _rec_name = "label" |
1779 | @@ -635,9 +613,8 @@ | |||
1780 | 635 | else: | 613 | else: |
1781 | 636 | return False | 614 | return False |
1782 | 637 | 615 | ||
1783 | 638 | magerp_product_attribute_options() | ||
1784 | 639 | 616 | ||
1786 | 640 | class magerp_product_attribute_set(magerp_osv.magerp_osv): | 617 | class magerp_product_attribute_set(MagerpModel): |
1787 | 641 | _name = "magerp.product_attribute_set" | 618 | _name = "magerp.product_attribute_set" |
1788 | 642 | _description = "Attribute sets in products" | 619 | _description = "Attribute sets in products" |
1789 | 643 | _rec_name = 'attribute_set_name' | 620 | _rec_name = 'attribute_set_name' |
1790 | @@ -649,8 +626,8 @@ | |||
1791 | 649 | 'referential_id':fields.many2one('external.referential', 'Magento Instance', readonly=True), | 626 | 'referential_id':fields.many2one('external.referential', 'Magento Instance', readonly=True), |
1792 | 650 | 'magento_id':fields.integer('Magento ID'), | 627 | 'magento_id':fields.integer('Magento ID'), |
1793 | 651 | } | 628 | } |
1796 | 652 | 629 | ||
1797 | 653 | 630 | ||
1798 | 654 | def update_attribute(self, cr, uid, ids, context=None): | 631 | def update_attribute(self, cr, uid, ids, context=None): |
1799 | 655 | ref_obj = self.pool.get('external.referential') | 632 | ref_obj = self.pool.get('external.referential') |
1800 | 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) |
1801 | @@ -735,9 +712,8 @@ | |||
1802 | 735 | cr.execute(query) | 712 | cr.execute(query) |
1803 | 736 | return True | 713 | return True |
1804 | 737 | 714 | ||
1805 | 738 | magerp_product_attribute_set() | ||
1806 | 739 | 715 | ||
1808 | 740 | class magerp_product_attribute_groups(magerp_osv.magerp_osv): | 716 | class magerp_product_attribute_groups(MagerpModel): |
1809 | 741 | _name = "magerp.product_attribute_groups" | 717 | _name = "magerp.product_attribute_groups" |
1810 | 742 | _description = "Attribute groups in Magento" | 718 | _description = "Attribute groups in Magento" |
1811 | 743 | _rec_name = 'attribute_group_name' | 719 | _rec_name = 'attribute_group_name' |
1812 | @@ -759,10 +735,9 @@ | |||
1813 | 759 | 'sort_order':fields.integer('Sort Order'), | 735 | 'sort_order':fields.integer('Sort Order'), |
1814 | 760 | 'default_id':fields.integer('Default'), | 736 | 'default_id':fields.integer('Default'), |
1815 | 761 | 'referential_id':fields.many2one('external.referential', 'Magento Instance', readonly=True), | 737 | 'referential_id':fields.many2one('external.referential', 'Magento Instance', readonly=True), |
1818 | 762 | } | 738 | } |
1817 | 763 | magerp_product_attribute_groups() | ||
1819 | 764 | 739 | ||
1821 | 765 | class product_tierprice(osv.osv): | 740 | class product_tierprice(Model): |
1822 | 766 | _name = "product.tierprice" | 741 | _name = "product.tierprice" |
1823 | 767 | _description = "Implements magento tier pricing" | 742 | _description = "Implements magento tier pricing" |
1824 | 768 | 743 | ||
1825 | @@ -782,7 +757,7 @@ | |||
1826 | 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"), |
1827 | 783 | 'product':fields.many2one('product.product', 'Product'), | 758 | 'product':fields.many2one('product.product', 'Product'), |
1828 | 784 | 'referential_id':fields.many2one('external.referential', 'Magento Instance', readonly=True), | 759 | 'referential_id':fields.many2one('external.referential', 'Magento Instance', readonly=True), |
1830 | 785 | } | 760 | } |
1831 | 786 | _mapping = { | 761 | _mapping = { |
1832 | 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)]"""), |
1833 | 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')]"""), |
1834 | @@ -790,21 +765,18 @@ | |||
1835 | 790 | 'price':('price', float), | 765 | 'price':('price', float), |
1836 | 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)]"""), |
1837 | 792 | 'price_qty':('price_qty', float), | 767 | 'price_qty':('price_qty', float), |
1840 | 793 | } | 768 | } |
1839 | 794 | product_tierprice() | ||
1841 | 795 | 769 | ||
1843 | 796 | class product_product_type(osv.osv): | 770 | class product_product_type(Model): |
1844 | 797 | _name = 'magerp.product_product_type' | 771 | _name = 'magerp.product_product_type' |
1845 | 798 | _columns = { | 772 | _columns = { |
1846 | 799 | 'name': fields.char('Name', size=100, required=True, translate=True), | 773 | 'name': fields.char('Name', size=100, required=True, translate=True), |
1847 | 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'."), |
1848 | 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."), |
1855 | 802 | } | 776 | } |
1856 | 803 | product_product_type() | 777 | |
1857 | 804 | 778 | ||
1858 | 805 | 779 | class product_mag_osv(MagerpModel): | |
1853 | 806 | |||
1854 | 807 | class product_mag_osv(magerp_osv.magerp_osv): | ||
1859 | 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. |
1860 | 809 | 781 | ||
1861 | 810 | #remember one thing in life: Magento lies: it tells attributes are required while they are awkward to fill | 782 | #remember one thing in life: Magento lies: it tells attributes are required while they are awkward to fill |
1862 | @@ -819,7 +791,7 @@ | |||
1863 | 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'] |
1864 | 820 | 792 | ||
1865 | 821 | if not set_id: | 793 | if not set_id: |
1867 | 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')) |
1868 | 823 | 795 | ||
1869 | 824 | return { | 796 | return { |
1870 | 825 | 'name': 'Magento Fields', | 797 | 'name': 'Magento Fields', |
1871 | @@ -948,17 +920,15 @@ | |||
1872 | 948 | f.set('nolabel', "1") | 920 | f.set('nolabel', "1") |
1873 | 949 | f.set('colspan', "4") | 921 | f.set('colspan', "4") |
1874 | 950 | 922 | ||
1878 | 951 | orm.setup_modifiers( | 923 | setup_modifiers(f, fields_get[attribute['field_name']], |
1879 | 952 | f, fields_get[attribute['field_name']], | 924 | context=context) |
1877 | 953 | context=context) | ||
1880 | 954 | 925 | ||
1881 | 955 | if multiwebsites: | 926 | if multiwebsites: |
1882 | 956 | website_page = etree.SubElement( | 927 | website_page = etree.SubElement( |
1883 | 957 | notebook, 'page', string=_('Websites')) | 928 | notebook, 'page', string=_('Websites')) |
1884 | 958 | wf = etree.SubElement( | 929 | wf = etree.SubElement( |
1885 | 959 | website_page, 'field', name='websites_ids', nolabel="1") | 930 | website_page, 'field', name='websites_ids', nolabel="1") |
1888 | 960 | orm.setup_modifiers( | 931 | setup_modifiers(wf, fields_get['websites_ids'], context=context) |
1887 | 961 | wf, fields_get['websites_ids'], context=context) | ||
1889 | 962 | 932 | ||
1890 | 963 | return notebook | 933 | return notebook |
1891 | 964 | 934 | ||
1892 | @@ -1025,14 +995,13 @@ | |||
1893 | 1025 | 'page', | 995 | 'page', |
1894 | 1026 | string=_('Magento Information'), | 996 | string=_('Magento Information'), |
1895 | 1027 | attrs=attrs_mag_notebook) | 997 | attrs=attrs_mag_notebook) |
1897 | 1028 | orm.setup_modifiers(magento_page, context=context) | 998 | setup_modifiers(magento_page, context=context) |
1898 | 1029 | f = etree.SubElement( | 999 | f = etree.SubElement( |
1899 | 1030 | magento_page, | 1000 | magento_page, |
1900 | 1031 | 'field', | 1001 | 'field', |
1901 | 1032 | name='product_type', | 1002 | name='product_type', |
1902 | 1033 | attrs="{'required': [('magento_exportable', '=', True)]}") | 1003 | attrs="{'required': [('magento_exportable', '=', True)]}") |
1905 | 1034 | orm.setup_modifiers( | 1004 | setup_modifiers(f, field=result['fields']['product_type'], context=context) |
1904 | 1035 | f, field=result['fields']['product_type'], context=context) | ||
1906 | 1036 | magento_page.append(attributes_notebook) | 1005 | magento_page.append(attributes_notebook) |
1907 | 1037 | btn.getparent().remove(btn) | 1006 | btn.getparent().remove(btn) |
1908 | 1038 | else: | 1007 | else: |
1909 | @@ -1050,18 +1019,21 @@ | |||
1910 | 1050 | type='object', | 1019 | type='object', |
1911 | 1051 | colspan='2', | 1020 | colspan='2', |
1912 | 1052 | attrs=attrs_mag_notebook) | 1021 | attrs=attrs_mag_notebook) |
1914 | 1053 | orm.setup_modifiers(new_btn, context=context) | 1022 | setup_modifiers(new_btn, context=context) |
1915 | 1054 | btn.getparent().replace(btn, new_btn) | 1023 | btn.getparent().replace(btn, new_btn) |
1916 | 1055 | if page_placeholder: | 1024 | if page_placeholder: |
1917 | 1056 | placeholder = page_placeholder[0] | 1025 | placeholder = page_placeholder[0] |
1918 | 1057 | placeholder.getparent().remove(placeholder) | 1026 | placeholder.getparent().remove(placeholder) |
1919 | 1058 | 1027 | ||
1920 | 1059 | result['arch'] = etree.tostring(eview, pretty_print=True) | 1028 | result['arch'] = etree.tostring(eview, pretty_print=True) |
1921 | 1029 | #TODO understand (and fix) why the orm fill the field size for the text field :S | ||
1922 | 1030 | for field in result['fields']: | ||
1923 | 1031 | if result['fields'][field]['type'] == 'text': | ||
1924 | 1032 | if 'size' in result['fields'][field]: del result['fields'][field]['size'] | ||
1925 | 1060 | return result | 1033 | return result |
1926 | 1061 | 1034 | ||
1927 | 1062 | class product_template(product_mag_osv): | 1035 | class product_template(product_mag_osv): |
1928 | 1063 | _inherit = "product.template" | 1036 | _inherit = "product.template" |
1929 | 1064 | |||
1930 | 1065 | _columns = { | 1037 | _columns = { |
1931 | 1066 | 'magerp_tmpl' : fields.serialized('Magento Template Fields'), | 1038 | 'magerp_tmpl' : fields.serialized('Magento Template Fields'), |
1932 | 1067 | 'set':fields.many2one('magerp.product_attribute_set', 'Attribute Set'), | 1039 | 'set':fields.many2one('magerp.product_attribute_set', 'Attribute Set'), |
1933 | @@ -1071,19 +1043,15 @@ | |||
1934 | 1071 | ('no', 'Do Not Manage Stock'), | 1043 | ('no', 'Do Not Manage Stock'), |
1935 | 1072 | ('yes','Manage Stock')], | 1044 | ('yes','Manage Stock')], |
1936 | 1073 | 'Manage Stock Level'), | 1045 | 'Manage Stock Level'), |
1939 | 1074 | } | 1046 | } |
1938 | 1075 | |||
1940 | 1076 | _defaults = { | 1047 | _defaults = { |
1941 | 1077 | 'mag_manage_stock': 'use_default', | 1048 | 'mag_manage_stock': 'use_default', |
1945 | 1078 | } | 1049 | } |
1943 | 1079 | |||
1944 | 1080 | product_template() | ||
1946 | 1081 | 1050 | ||
1947 | 1082 | 1051 | ||
1948 | 1083 | class product_product(product_mag_osv): | 1052 | class product_product(product_mag_osv): |
1949 | 1084 | _inherit = "product.product" | 1053 | _inherit = "product.product" |
1950 | 1085 | 1054 | ||
1951 | 1086 | |||
1952 | 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): |
1953 | 1088 | product_ids = resources.keys() | 1056 | product_ids = resources.keys() |
1954 | 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) |
1955 | @@ -1096,7 +1064,7 @@ | |||
1956 | 1096 | ext_id = res['product_id'] | 1064 | ext_id = res['product_id'] |
1957 | 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']) |
1958 | 1098 | return ext_id | 1066 | return ext_id |
1960 | 1099 | 1067 | ||
1961 | 1100 | @only_for_referential('magento') | 1068 | @only_for_referential('magento') |
1962 | 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, |
1963 | 1102 | mapping=None, mapping_id=None, fields=None, context=None): | 1070 | mapping=None, mapping_id=None, fields=None, context=None): |
1964 | @@ -1110,8 +1078,8 @@ | |||
1965 | 1110 | mapping_id=mapping_id, | 1078 | mapping_id=mapping_id, |
1966 | 1111 | fields=fields, | 1079 | fields=fields, |
1967 | 1112 | context=context) | 1080 | context=context) |
1970 | 1113 | 1081 | ||
1971 | 1114 | 1082 | ||
1972 | 1115 | #TODO reimplement the grouped product | 1083 | #TODO reimplement the grouped product |
1973 | 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): |
1974 | 1117 | ext_create_ids={} | 1085 | ext_create_ids={} |
1975 | @@ -1134,7 +1102,7 @@ | |||
1976 | 1134 | try: | 1102 | try: |
1977 | 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) |
1978 | 1136 | except: | 1104 | except: |
1980 | 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)) |
1981 | 1138 | else: | 1106 | else: |
1982 | 1139 | raise | 1107 | raise |
1983 | 1140 | 1108 | ||
1984 | @@ -1256,10 +1224,10 @@ | |||
1985 | 1256 | set_to_product_ids[product.set.id] = [product.id] | 1224 | set_to_product_ids[product.set.id] = [product.id] |
1986 | 1257 | else: | 1225 | else: |
1987 | 1258 | set_to_product_ids[product.set.id].append(product.id) | 1226 | set_to_product_ids[product.set.id].append(product.id) |
1989 | 1259 | for attribut_id in set_to_product_ids: | 1227 | for attribut_id, product_ids in set_to_product_ids.iteritems(): |
1990 | 1260 | context['attribut_set_id'] = attribut_id | 1228 | context['attribut_set_id'] = attribut_id |
1991 | 1261 | resources.update(super(product_product, self)._get_oe_resources( | 1229 | resources.update(super(product_product, self)._get_oe_resources( |
1993 | 1262 | cr, uid, external_session, ids, langs, | 1230 | cr, uid, external_session, product_ids, langs, |
1994 | 1263 | smart_export=smart_export, | 1231 | smart_export=smart_export, |
1995 | 1264 | last_exported_date=last_exported_date, | 1232 | last_exported_date=last_exported_date, |
1996 | 1265 | mapping=mapping, | 1233 | mapping=mapping, |
1997 | @@ -1391,9 +1359,17 @@ | |||
1998 | 1391 | break | 1359 | break |
1999 | 1392 | if not_delete: | 1360 | if not_delete: |
2000 | 1393 | if len(ids) > 1: | 1361 | if len(ids) > 1: |
2002 | 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!'), |
2003 | 1363 | _('They are some products related to Magento. ' | ||
2004 | 1364 | 'They can not be deleted!\n' | ||
2005 | 1365 | 'You can change their Magento status to "Disabled" ' | ||
2006 | 1366 | 'and uncheck the active box to hide them from OpenERP.')) | ||
2007 | 1395 | else: | 1367 | else: |
2009 | 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!'), |
2010 | 1369 | _('This product is related to Magento. ' | ||
2011 | 1370 | 'It can not be deleted!\n' | ||
2012 | 1371 | 'You can change it Magento status to "Disabled" ' | ||
2013 | 1372 | 'and uncheck the active box to hide it from OpenERP.')) | ||
2014 | 1397 | else: | 1373 | else: |
2015 | 1398 | return super(product_product, self).unlink(cr, uid, ids, context) | 1374 | return super(product_product, self).unlink(cr, uid, ids, context) |
2016 | 1399 | 1375 | ||
2017 | @@ -1433,29 +1409,20 @@ | |||
2018 | 1433 | #This can be base on the group_fields that can try tle last write date of a group of fields | 1409 | #This can be base on the group_fields that can try tle last write date of a group of fields |
2019 | 1434 | if context is None: context = {} | 1410 | if context is None: context = {} |
2020 | 1435 | 1411 | ||
2021 | 1436 | shop = external_session.sync_from_object | ||
2022 | 1437 | |||
2023 | 1438 | # exclude service products | ||
2024 | 1439 | stock_product_ids = self.search( | ||
2025 | 1440 | cr, uid, | ||
2026 | 1441 | [('id', 'in', ids), | ||
2027 | 1442 | ('type', '!=', 'service'), | ||
2028 | 1443 | ('magento_exportable', '=', True)], | ||
2029 | 1444 | context=context) | ||
2030 | 1445 | |||
2031 | 1446 | # use the stock location defined on the sale shop | 1412 | # use the stock location defined on the sale shop |
2032 | 1447 | # to compute the stock value | 1413 | # to compute the stock value |
2034 | 1448 | stock = shop.warehouse_id.lot_stock_id | 1414 | stock = external_session.sync_from_object.warehouse_id.lot_stock_id |
2035 | 1449 | location_ctx = context.copy() | 1415 | location_ctx = context.copy() |
2036 | 1450 | location_ctx['location'] = stock.id | 1416 | location_ctx['location'] = stock.id |
2039 | 1451 | products = self.browse( | 1417 | for product_id in ids: |
2040 | 1452 | cr, uid, stock_product_ids, context=location_ctx) | 1418 | self._export_inventory(cr, uid, external_session, product_id, context=location_ctx) |
2041 | 1453 | 1419 | ||
2042 | 1454 | for product in products: | ||
2043 | 1455 | self._export_inventory(cr, uid, external_session, product, stock, context=location_ctx) | ||
2044 | 1456 | return True | 1420 | return True |
2045 | 1457 | 1421 | ||
2047 | 1458 | def _export_inventory(self, cr, uid, external_session, product, stock, context=None): | 1422 | @catch_error_in_report |
2048 | 1423 | def _export_inventory(self, cr, uid, external_session, product_id, context=None): | ||
2049 | 1424 | product = self.browse(cr, uid, product_id, context=context) | ||
2050 | 1425 | stock = external_session.sync_from_object.warehouse_id.lot_stock_id | ||
2051 | 1459 | mag_product_id = self.get_extid( | 1426 | mag_product_id = self.get_extid( |
2052 | 1460 | cr, uid, product.id, external_session.referential_id.id, context=context) | 1427 | cr, uid, product.id, external_session.referential_id.id, context=context) |
2053 | 1461 | if not mag_product_id: | 1428 | if not mag_product_id: |
2054 | @@ -1463,7 +1430,7 @@ | |||
2055 | 1463 | inventory_vals = self._prepare_inventory_magento_vals( | 1430 | inventory_vals = self._prepare_inventory_magento_vals( |
2056 | 1464 | cr, uid, product, stock, external_session.sync_from_object, context=context) | 1431 | cr, uid, product, stock, external_session.sync_from_object, context=context) |
2057 | 1465 | 1432 | ||
2059 | 1466 | external_session.connection.call('product_stock.update', | 1433 | external_session.connection.call('oerp_cataloginventory_stock_item.update', |
2060 | 1467 | [mag_product_id, inventory_vals]) | 1434 | [mag_product_id, inventory_vals]) |
2061 | 1468 | 1435 | ||
2062 | 1469 | external_session.logger.info( | 1436 | external_session.logger.info( |
2063 | @@ -1617,5 +1584,3 @@ | |||
2064 | 1617 | finally: | 1584 | finally: |
2065 | 1618 | local_cr.close() | 1585 | local_cr.close() |
2066 | 1619 | return True | 1586 | return True |
2067 | 1620 | |||
2068 | 1621 | product_product() | ||
2069 | 1622 | 1587 | ||
2070 | === modified file 'magentoerpconnect/product_images.py' | |||
2071 | --- magentoerpconnect/product_images.py 2012-06-22 10:15:40 +0000 | |||
2072 | +++ magentoerpconnect/product_images.py 2012-12-03 15:22:20 +0000 | |||
2073 | @@ -20,22 +20,30 @@ | |||
2074 | 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 # |
2075 | 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/>. # |
2076 | 22 | ######################################################################### | 22 | ######################################################################### |
2077 | 23 | from osv import osv, fields | ||
2078 | 24 | import magerp_osv | ||
2079 | 25 | import mimetypes | 23 | import mimetypes |
2083 | 26 | import netsvc | 24 | |
2084 | 27 | from tools.translate import _ | 25 | from openerp.osv.orm import Model |
2085 | 28 | import base64 | 26 | from openerp.osv import fields |
2086 | 27 | from openerp.tools.translate import _ | ||
2087 | 28 | |||
2088 | 29 | from .magerp_osv import MagerpModel | ||
2089 | 29 | from base_external_referentials.decorator import commit_now | 30 | from base_external_referentials.decorator import commit_now |
2090 | 30 | from base_external_referentials.decorator import only_for_referential | 31 | from base_external_referentials.decorator import only_for_referential |
2091 | 31 | 32 | ||
2099 | 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 |
2100 | 33 | #Moreover when a small is selected the flag on other image should be remove as magento does | 34 | #Indeed when you have two Magento maybe you do not want to use the |
2101 | 34 | 35 | #same image for the base_image, thumbnail ot small_image | |
2102 | 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 |
2103 | 36 | #To must useless line of code | 37 | #value for each referential |
2104 | 37 | 38 | ||
2105 | 38 | class product_images(magerp_osv.magerp_osv): | 39 | #TODO As only one image can be a small_image, thumbnail or base_image |
2106 | 40 | #We should add some constraint or automatically remove the flag on the | ||
2107 | 41 | #other image of the product. | ||
2108 | 42 | |||
2109 | 43 | #TODO refactor all of this code and use the generic function from | ||
2110 | 44 | #base_external_referentials. | ||
2111 | 45 | |||
2112 | 46 | class product_images(MagerpModel): | ||
2113 | 39 | _inherit = "product.images" | 47 | _inherit = "product.images" |
2114 | 40 | _columns = { | 48 | _columns = { |
2115 | 41 | 'base_image':fields.boolean('Base Image'), | 49 | 'base_image':fields.boolean('Base Image'), |
2116 | @@ -46,20 +54,20 @@ | |||
2117 | 46 | 'sync_status':fields.boolean('Sync Status', readonly=True), | 54 | 'sync_status':fields.boolean('Sync Status', readonly=True), |
2118 | 47 | 'create_date': fields.datetime('Created date', readonly=True), | 55 | 'create_date': fields.datetime('Created date', readonly=True), |
2119 | 48 | 'write_date': fields.datetime('Updated date', readonly=True), | 56 | 'write_date': fields.datetime('Updated date', readonly=True), |
2121 | 49 | } | 57 | } |
2122 | 50 | _defaults = { | 58 | _defaults = { |
2123 | 51 | 'sync_status':lambda * a: False, | 59 | 'sync_status':lambda * a: False, |
2124 | 52 | 'base_image':lambda * a:True, | 60 | 'base_image':lambda * a:True, |
2125 | 53 | 'small_image':lambda * a:True, | 61 | 'small_image':lambda * a:True, |
2126 | 54 | 'thumbnail':lambda * a:True, | 62 | 'thumbnail':lambda * a:True, |
2127 | 55 | 'exclude':lambda * a:False | 63 | 'exclude':lambda * a:False |
2130 | 56 | } | 64 | } |
2131 | 57 | 65 | ||
2132 | 58 | def get_changed_ids(self, cr, uid, start_date=False): | 66 | def get_changed_ids(self, cr, uid, start_date=False): |
2133 | 59 | proxy = self.pool.get('product.images') | 67 | proxy = self.pool.get('product.images') |
2134 | 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 [] |
2135 | 61 | return proxy.search(cr, uid, domain) | 69 | return proxy.search(cr, uid, domain) |
2137 | 62 | 70 | ||
2138 | 63 | def del_image_name(self, cr, uid, id, context=None): | 71 | def del_image_name(self, cr, uid, id, context=None): |
2139 | 64 | if context is None: context = {} | 72 | if context is None: context = {} |
2140 | 65 | image_ext_name_obj = self.pool.get('product.images.external.name') | 73 | image_ext_name_obj = self.pool.get('product.images.external.name') |
2141 | @@ -129,7 +137,7 @@ | |||
2142 | 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'] |
2143 | 130 | list_date = date_2_image.keys() | 138 | list_date = date_2_image.keys() |
2144 | 131 | list_date.sort() | 139 | list_date.sort() |
2146 | 132 | 140 | ||
2147 | 133 | ids = [date_2_image[date] for date in list_date] | 141 | ids = [date_2_image[date] for date in list_date] |
2148 | 134 | 142 | ||
2149 | 135 | while ids: | 143 | while ids: |
2150 | @@ -185,5 +193,3 @@ | |||
2151 | 185 | ids = ids[1000:] | 193 | ids = ids[1000:] |
2152 | 186 | external_session.logger.info("still %s image to export" %len(ids)) | 194 | external_session.logger.info("still %s image to export" %len(ids)) |
2153 | 187 | return True | 195 | return True |
2154 | 188 | |||
2155 | 189 | product_images() | ||
2156 | 190 | 196 | ||
2157 | === modified file 'magentoerpconnect/product_images_view.xml' | |||
2158 | --- magentoerpconnect/product_images_view.xml 2011-11-27 15:12:39 +0000 | |||
2159 | +++ magentoerpconnect/product_images_view.xml 2012-12-03 15:22:20 +0000 | |||
2160 | @@ -1,24 +1,24 @@ | |||
2161 | 1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2162 | 2 | <openerp> | 2 | <openerp> |
2184 | 3 | <data> | 3 | <data> |
2185 | 4 | <record id="view_product_image_form" model="ir.ui.view"> | 4 | <record id="view_product_image_form" model="ir.ui.view"> |
2186 | 5 | <field name="name">product.images.form.inherit</field> | 5 | <field name="name">product.images.form.inherit</field> |
2187 | 6 | <field name="model">product.images</field> | 6 | <field name="model">product.images</field> |
2188 | 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" /> |
2189 | 8 | <field name="type">form</field> | 8 | <field name="type">form</field> |
2190 | 9 | <field name="arch" type="xml"> | 9 | <field name="arch" type="xml"> |
2191 | 10 | <xpath expr="/form/notebook/page/field[@name='file']" | 10 | <xpath expr="/form/notebook/page/field[@name='file']" |
2192 | 11 | position="after"> | 11 | position="after"> |
2193 | 12 | <group col="4" colspan="2"> | 12 | <group col="4" colspan="2"> |
2194 | 13 | <field name="base_image" colspan="4" /> | 13 | <field name="base_image" colspan="4" /> |
2195 | 14 | <field name="small_image" colspan="4" /> | 14 | <field name="small_image" colspan="4" /> |
2196 | 15 | </group> | 15 | </group> |
2197 | 16 | <group col="4" colspan="2"> | 16 | <group col="4" colspan="2"> |
2198 | 17 | <field name="thumbnail" colspan="4" /> | 17 | <field name="thumbnail" colspan="4" /> |
2199 | 18 | <field name="exclude" colspan="4" /> | 18 | <field name="exclude" colspan="4" /> |
2200 | 19 | </group> | 19 | </group> |
2201 | 20 | </xpath> | 20 | </xpath> |
2202 | 21 | </field> | 21 | </field> |
2203 | 22 | </record> | 22 | </record> |
2204 | 23 | </data> | 23 | </data> |
2205 | 24 | </openerp> | 24 | </openerp> |
2206 | 25 | 25 | ||
2207 | === modified file 'magentoerpconnect/product_links.py' | |||
2208 | --- magentoerpconnect/product_links.py 2011-06-07 14:33:14 +0000 | |||
2209 | +++ magentoerpconnect/product_links.py 2012-12-03 15:22:20 +0000 | |||
2210 | @@ -18,14 +18,10 @@ | |||
2211 | 18 | # | 18 | # |
2212 | 19 | ############################################################################## | 19 | ############################################################################## |
2213 | 20 | 20 | ||
2218 | 21 | from osv import fields, osv | 21 | from openerp.osv.orm import Model |
2219 | 22 | 22 | from openerp.osv import fields | |
2220 | 23 | 23 | ||
2221 | 24 | class product_link(osv.osv): | 24 | class product_link(Model): |
2222 | 25 | _inherit = 'product.link' | 25 | _inherit = 'product.link' |
2229 | 26 | 26 | _columns = {'sequence': fields.integer('Position'), | |
2230 | 27 | _columns = { | 27 | } |
2225 | 28 | 'sequence': fields.integer('Position'), | ||
2226 | 29 | } | ||
2227 | 30 | |||
2228 | 31 | product_link() | ||
2231 | 32 | 28 | ||
2232 | === modified file 'magentoerpconnect/product_view.xml' | |||
2233 | --- magentoerpconnect/product_view.xml 2012-06-21 16:33:03 +0000 | |||
2234 | +++ magentoerpconnect/product_view.xml 2012-12-03 15:22:20 +0000 | |||
2235 | @@ -1,270 +1,270 @@ | |||
2236 | 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2237 | 2 | <openerp> | 2 | <openerp> |
2240 | 3 | <data> | 3 | <data> |
2241 | 4 | <!--Magento Product Category Tree/Form view --> | 4 | <!--Magento Product Category Tree/Form view --> |
2242 | 5 | 5 | ||
2262 | 6 | <record model="ir.ui.view" id="product_category_form_view_magerp2"> | 6 | <record model="ir.ui.view" id="product_category_form_view_magerp2"> |
2263 | 7 | <field name="name">product.category.form_view_magerp2</field> | 7 | <field name="name">product.category.form_view_magerp2</field> |
2264 | 8 | <field name="model">product.category</field> | 8 | <field name="model">product.category</field> |
2265 | 9 | <field name="inherit_id" ref="product.product_category_form_view" /> | 9 | <field name="inherit_id" ref="product.product_category_form_view" /> |
2266 | 10 | <field name="type">form</field> | 10 | <field name="type">form</field> |
2267 | 11 | <field name="arch" type="xml"> | 11 | <field name="arch" type="xml"> |
2268 | 12 | <xpath expr="/form/field[@name='sequence']" position="after"> | 12 | <xpath expr="/form/field[@name='sequence']" position="after"> |
2269 | 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)]}"> |
2270 | 14 | <separator string="Magento Information" colspan="4" /> | 14 | <separator string="Magento Information" colspan="4" /> |
2271 | 15 | <notebook attrs="{'invisible':[('magento_exportable','!=',1)]}" colspan="4"> | 15 | <notebook attrs="{'invisible':[('magento_exportable','!=',1)]}" colspan="4"> |
2272 | 16 | <page string="General Information"> | 16 | <page string="General Information"> |
2273 | 17 | <group cols="2" colspan="4"> | 17 | <group cols="2" colspan="4"> |
2274 | 18 | <group col="2" colspan="1"> | 18 | <group col="2" colspan="1"> |
2275 | 19 | <separator string="Meta Information" colspan="2" /> | 19 | <separator string="Meta Information" colspan="2" /> |
2276 | 20 | <field name="meta_title" colspan="2" /> | 20 | <field name="meta_title" colspan="2" /> |
2277 | 21 | <field name="meta_keywords" colspan="2" /> | 21 | <field name="meta_keywords" colspan="2" /> |
2278 | 22 | <field name="meta_description" colspan="2" /> | 22 | <field name="meta_description" colspan="2" /> |
2279 | 23 | <field name="url_key" colspan="2" /> | 23 | <field name="url_key" colspan="2" /> |
2280 | 24 | <field name="level" colspan="2" /> | 24 | <field name="level" colspan="2" /> |
2281 | 25 | <field name="include_in_menu" colspan="2" /> | 25 | <field name="include_in_menu" colspan="2" /> |
2295 | 26 | </group> | 26 | </group> |
2296 | 27 | <group col="1" colspan="1"> | 27 | <group col="1" colspan="1"> |
2297 | 28 | <separator string="Category Image" /> | 28 | <separator string="Category Image" /> |
2298 | 29 | <field name="image" nolabel="1" widget="image" /> | 29 | <field name="image" nolabel="1" widget="image" /> |
2299 | 30 | <field name="image_name" colspan="1" nolabel="1" /> | 30 | <field name="image_name" colspan="1" nolabel="1" /> |
2300 | 31 | <separator string="Description" /> | 31 | <separator string="Description" /> |
2301 | 32 | <field name="description" colspan="1" nolabel="1" /> | 32 | <field name="description" colspan="1" nolabel="1" /> |
2302 | 33 | <group col="4" colspan="1"> | 33 | <group col="4" colspan="1"> |
2303 | 34 | <field name="is_active" colspan="1" /> | 34 | <field name="is_active" colspan="1" /> |
2304 | 35 | <field name="magento_parent_id" /> | 35 | <field name="magento_parent_id" /> |
2305 | 36 | </group> | 36 | </group> |
2306 | 37 | </group> | 37 | </group> |
2307 | 38 | </group> | 38 | </group> |
2308 | 39 | 39 | ||
2321 | 40 | </page> | 40 | </page> |
2322 | 41 | <page string="Display Settings"> | 41 | <page string="Display Settings"> |
2323 | 42 | <group col="4" colspan="4"> | 42 | <group col="4" colspan="4"> |
2324 | 43 | <separator string="Display Mode" colspan="4" /> | 43 | <separator string="Display Mode" colspan="4" /> |
2325 | 44 | <field name="display_mode" colspan="1" nolabel="1" /> | 44 | <field name="display_mode" colspan="1" nolabel="1" /> |
2326 | 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" /> |
2327 | 46 | </group> | 46 | </group> |
2328 | 47 | <separator string="Use Anchor" colspan="4" /> | 47 | <separator string="Use Anchor" colspan="4" /> |
2329 | 48 | <group col="4" colspan="4"> | 48 | <group col="4" colspan="4"> |
2330 | 49 | <field name="is_anchor" colspan="1" /> | 49 | <field name="is_anchor" colspan="1" /> |
2331 | 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" /> |
2332 | 51 | </group> | 51 | </group> |
2333 | 52 | <group col="4" colspan="4"> | 52 | <group col="4" colspan="4"> |
2334 | 53 | <group col="10" colspan="2"> | 53 | <group col="10" colspan="2"> |
2336 | 54 | <separator string="Available Sorting method" colspan="10" /> | 54 | <separator string="Available Sorting method" colspan="10" /> |
2337 | 55 | <field name="use_default_available_sort_by" string="Use Default Config"/> | 55 | <field name="use_default_available_sort_by" string="Use Default Config"/> |
2339 | 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)]}"> |
2340 | 57 | <tree string="Available Sort By"> | 57 | <tree string="Available Sort By"> |
2341 | 58 | <field name="label"/> | 58 | <field name="label"/> |
2342 | 59 | </tree> | 59 | </tree> |
2343 | 60 | </field> | 60 | </field> |
2345 | 61 | </group> | 61 | </group> |
2346 | 62 | <group col="2" colspan="2"> | 62 | <group col="2" colspan="2"> |
2351 | 63 | <separator string="Default Sorting method" colspan="2" /> | 63 | <separator string="Default Sorting method" colspan="2" /> |
2352 | 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')]"/> |
2353 | 65 | <separator string="Page Layout" colspan="2" /> | 65 | <separator string="Page Layout" colspan="2" /> |
2354 | 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')]"/> |
2355 | 67 | </group> | 67 | </group> |
2356 | 68 | </group> | 68 | </group> |
2450 | 69 | </page> | 69 | </page> |
2451 | 70 | </notebook> | 70 | </notebook> |
2452 | 71 | </group> | 71 | </group> |
2453 | 72 | </xpath> | 72 | </xpath> |
2454 | 73 | </field> | 73 | </field> |
2455 | 74 | </record> | 74 | </record> |
2456 | 75 | 75 | ||
2457 | 76 | <record model="ir.ui.view" id="product_category_form_view_magerp"> | 76 | <record model="ir.ui.view" id="product_category_form_view_magerp"> |
2458 | 77 | <field name="name">product.category.form_view_magerp</field> | 77 | <field name="name">product.category.form_view_magerp</field> |
2459 | 78 | <field name="model">product.category</field> | 78 | <field name="model">product.category</field> |
2460 | 79 | <field name="inherit_id" ref="product.product_category_form_view" /> | 79 | <field name="inherit_id" ref="product.product_category_form_view" /> |
2461 | 80 | <field name="type">form</field> | 80 | <field name="type">form</field> |
2462 | 81 | <field name="arch" type="xml"> | 81 | <field name="arch" type="xml"> |
2463 | 82 | <field name="sequence" position="after"> | 82 | <field name="sequence" position="after"> |
2464 | 83 | <field name="magento_exportable" /> | 83 | <field name="magento_exportable" /> |
2465 | 84 | </field> | 84 | </field> |
2466 | 85 | </field> | 85 | </field> |
2467 | 86 | </record> | 86 | </record> |
2468 | 87 | 87 | ||
2469 | 88 | <!--Magento product_attribute_set Tree/Form view --> | 88 | <!--Magento product_attribute_set Tree/Form view --> |
2470 | 89 | <record model="ir.ui.view" id="magerp_product_attribute_set_form"> | 89 | <record model="ir.ui.view" id="magerp_product_attribute_set_form"> |
2471 | 90 | <field name="name">magerp.product_attribute_set.form</field> | 90 | <field name="name">magerp.product_attribute_set.form</field> |
2472 | 91 | <field name="model">magerp.product_attribute_set</field> | 91 | <field name="model">magerp.product_attribute_set</field> |
2473 | 92 | <field name="type">form</field> | 92 | <field name="type">form</field> |
2474 | 93 | <field name="arch" type="xml"> | 93 | <field name="arch" type="xml"> |
2475 | 94 | <form string="Magento Product Attribute Sets"> | 94 | <form string="Magento Product Attribute Sets"> |
2476 | 95 | <group col="4" colspan="4"> | 95 | <group col="4" colspan="4"> |
2477 | 96 | <field name="sort_order" readonly="1" /> | 96 | <field name="sort_order" readonly="1" /> |
2478 | 97 | <field name="attribute_set_name" readonly="1" /> | 97 | <field name="attribute_set_name" readonly="1" /> |
2479 | 98 | <button name="update_attribute" string="Update Attributes" colspan="2" type="object" /> | 98 | <button name="update_attribute" string="Update Attributes" colspan="2" type="object" /> |
2480 | 99 | </group> | 99 | </group> |
2481 | 100 | <separator string="Attributes in Set" colspan="4" /> | 100 | <separator string="Attributes in Set" colspan="4" /> |
2482 | 101 | <field name="attributes" nolabel="1" readonly="1" /> | 101 | <field name="attributes" nolabel="1" readonly="1" /> |
2483 | 102 | </form> | 102 | </form> |
2484 | 103 | </field> | 103 | </field> |
2485 | 104 | </record> | 104 | </record> |
2486 | 105 | <record model="ir.ui.view" id="magerp_product_attribute_set_tree"> | 105 | <record model="ir.ui.view" id="magerp_product_attribute_set_tree"> |
2487 | 106 | <field name="name">magerp.product_attribute_set.tree</field> | 106 | <field name="name">magerp.product_attribute_set.tree</field> |
2488 | 107 | <field name="model">magerp.product_attribute_set</field> | 107 | <field name="model">magerp.product_attribute_set</field> |
2489 | 108 | <field name="type">tree</field> | 108 | <field name="type">tree</field> |
2490 | 109 | <field name="arch" type="xml"> | 109 | <field name="arch" type="xml"> |
2491 | 110 | <tree string="Magento Product Attribute Set"> | 110 | <tree string="Magento Product Attribute Set"> |
2492 | 111 | <field name="sort_order" select="2" /> | 111 | <field name="sort_order" select="2" /> |
2493 | 112 | <field name="attribute_set_name" select="1" /> | 112 | <field name="attribute_set_name" select="1" /> |
2494 | 113 | </tree> | 113 | </tree> |
2495 | 114 | </field> | 114 | </field> |
2496 | 115 | </record> | 115 | </record> |
2497 | 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"> |
2498 | 117 | <field name="name">Magento Product Attribute Sets</field> | 117 | <field name="name">Magento Product Attribute Sets</field> |
2499 | 118 | <field name="res_model">magerp.product_attribute_set</field> | 118 | <field name="res_model">magerp.product_attribute_set</field> |
2500 | 119 | <field name="src_model">magerp.product_attribute_set</field> | 119 | <field name="src_model">magerp.product_attribute_set</field> |
2501 | 120 | <field name="type">ir.actions.act_window</field> | 120 | <field name="type">ir.actions.act_window</field> |
2502 | 121 | <field name="view_type">form</field> | 121 | <field name="view_type">form</field> |
2503 | 122 | <field name="view_mode">tree,form</field> | 122 | <field name="view_mode">tree,form</field> |
2504 | 123 | <field name="view_id" ref="magerp_product_attribute_set_tree" /> | 123 | <field name="view_id" ref="magerp_product_attribute_set_tree" /> |
2505 | 124 | </record> | 124 | </record> |
2506 | 125 | 125 | ||
2507 | 126 | <!--Magento product_attributes Tree/Form view --> | 126 | <!--Magento product_attributes Tree/Form view --> |
2508 | 127 | <record model="ir.ui.view" id="magerp_product_attributes_form"> | 127 | <record model="ir.ui.view" id="magerp_product_attributes_form"> |
2509 | 128 | <field name="name">magerp.product_attributes.form</field> | 128 | <field name="name">magerp.product_attributes.form</field> |
2510 | 129 | <field name="model">magerp.product_attributes</field> | 129 | <field name="model">magerp.product_attributes</field> |
2511 | 130 | <field name="type">form</field> | 130 | <field name="type">form</field> |
2512 | 131 | <field name="arch" type="xml"> | 131 | <field name="arch" type="xml"> |
2513 | 132 | <form string="Magento Product Attributes"> | 132 | <form string="Magento Product Attributes"> |
2514 | 133 | <group col="4" colspan="4"> | 133 | <group col="4" colspan="4"> |
2515 | 134 | <field name="attribute_code" /> | 134 | <field name="attribute_code" /> |
2516 | 135 | <field name="frontend_input" select="2" /> | 135 | <field name="frontend_input" select="2" /> |
2517 | 136 | <field name="frontend_class" /> | 136 | <field name="frontend_class" /> |
2518 | 137 | <field name="backend_model" /> | 137 | <field name="backend_model" /> |
2519 | 138 | <field name="backend_type" select="2" /> | 138 | <field name="backend_type" select="2" /> |
2520 | 139 | <field name="frontend_label"/> | 139 | <field name="frontend_label"/> |
2521 | 140 | 140 | ||
2522 | 141 | <field name="is_visible_in_advanced_search" select="2" /> | 141 | <field name="is_visible_in_advanced_search" select="2" /> |
2523 | 142 | <field name="is_global" /> | 142 | <field name="is_global" /> |
2524 | 143 | <field name="is_filterable" /> | 143 | <field name="is_filterable" /> |
2525 | 144 | <field name="is_comparable" /> | 144 | <field name="is_comparable" /> |
2526 | 145 | <field name="is_visible" /> | 145 | <field name="is_visible" /> |
2527 | 146 | <field name="is_searchable" /> | 146 | <field name="is_searchable" /> |
2528 | 147 | <field name="is_user_defined" /> | 147 | <field name="is_user_defined" /> |
2529 | 148 | <field name="is_configurable" /> | 148 | <field name="is_configurable" /> |
2530 | 149 | 149 | ||
2531 | 150 | <field name="is_visible_on_front" /> | 150 | <field name="is_visible_on_front" /> |
2532 | 151 | <field name="is_used_for_price_rules" /> | 151 | <field name="is_used_for_price_rules" /> |
2533 | 152 | <field name="is_unique" /> | 152 | <field name="is_unique" /> |
2534 | 153 | <field name="is_required" /> | 153 | <field name="is_required" /> |
2535 | 154 | <field name="position" /> | 154 | <field name="position" /> |
2536 | 155 | 155 | ||
2537 | 156 | <field name="group" /> | 156 | <field name="group" /> |
2538 | 157 | <field name="apply_to" select="2" /> | 157 | <field name="apply_to" select="2" /> |
2539 | 158 | <field name="default_value" /> | 158 | <field name="default_value" /> |
2540 | 159 | <field name="note" /> | 159 | <field name="note" /> |
2541 | 160 | <field name="entity_type_id" /> | 160 | <field name="entity_type_id" /> |
2542 | 161 | <field name="options" readonly="1" /> | 161 | <field name="options" readonly="1" /> |
2543 | 162 | <field name="field_name" /> | 162 | <field name="field_name" /> |
2544 | 163 | <field name="based_on" /> | 163 | <field name="based_on" /> |
2624 | 164 | </group> | 164 | </group> |
2625 | 165 | </form> | 165 | </form> |
2626 | 166 | </field> | 166 | </field> |
2627 | 167 | </record> | 167 | </record> |
2628 | 168 | <record model="ir.ui.view" id="magerp_product_attributes_tree"> | 168 | <record model="ir.ui.view" id="magerp_product_attributes_tree"> |
2629 | 169 | <field name="name">magerp.product_attributes.tree</field> | 169 | <field name="name">magerp.product_attributes.tree</field> |
2630 | 170 | <field name="model">magerp.product_attributes</field> | 170 | <field name="model">magerp.product_attributes</field> |
2631 | 171 | <field name="type">tree</field> | 171 | <field name="type">tree</field> |
2632 | 172 | <field name="arch" type="xml"> | 172 | <field name="arch" type="xml"> |
2633 | 173 | <tree string="Magento Product Attributes"> | 173 | <tree string="Magento Product Attributes"> |
2634 | 174 | <field name="attribute_code" select="1" /> | 174 | <field name="attribute_code" select="1" /> |
2635 | 175 | <field name="frontend_label" select="1"/> | 175 | <field name="frontend_label" select="1"/> |
2636 | 176 | <field name="is_visible" select="1"/> | 176 | <field name="is_visible" select="1"/> |
2637 | 177 | <field name="is_required" select="1"/> | 177 | <field name="is_required" select="1"/> |
2638 | 178 | <field name="is_searchable" select="1" /> | 178 | <field name="is_searchable" select="1" /> |
2639 | 179 | <field name="is_comparable" select="1" /> | 179 | <field name="is_comparable" select="1" /> |
2640 | 180 | <field name="entity_type_id" select="1" /> | 180 | <field name="entity_type_id" select="1" /> |
2641 | 181 | <field name="group" select="1" /> | 181 | <field name="group" select="1" /> |
2642 | 182 | </tree> | 182 | </tree> |
2643 | 183 | </field> | 183 | </field> |
2644 | 184 | </record> | 184 | </record> |
2645 | 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"> |
2646 | 186 | <field name="name">Magento Product Attributes</field> | 186 | <field name="name">Magento Product Attributes</field> |
2647 | 187 | <field name="res_model">magerp.product_attributes</field> | 187 | <field name="res_model">magerp.product_attributes</field> |
2648 | 188 | <field name="src_model">magerp.product_attributes</field> | 188 | <field name="src_model">magerp.product_attributes</field> |
2649 | 189 | <field name="type">ir.actions.act_window</field> | 189 | <field name="type">ir.actions.act_window</field> |
2650 | 190 | <field name="view_type">form</field> | 190 | <field name="view_type">form</field> |
2651 | 191 | <field name="view_mode">tree,form</field> | 191 | <field name="view_mode">tree,form</field> |
2652 | 192 | <field name="view_id" ref="magerp_product_attributes_tree" /> | 192 | <field name="view_id" ref="magerp_product_attributes_tree" /> |
2653 | 193 | </record> | 193 | </record> |
2654 | 194 | 194 | ||
2655 | 195 | <!--Magento product_attribute groups Tree/Form view --> | 195 | <!--Magento product_attribute groups Tree/Form view --> |
2656 | 196 | <record model="ir.ui.view" id="magerp_product_attribute_groups_form"> | 196 | <record model="ir.ui.view" id="magerp_product_attribute_groups_form"> |
2657 | 197 | <field name="name">magerp.product_attribute_groups.form</field> | 197 | <field name="name">magerp.product_attribute_groups.form</field> |
2658 | 198 | <field name="model">magerp.product_attribute_groups</field> | 198 | <field name="model">magerp.product_attribute_groups</field> |
2659 | 199 | <field name="type">form</field> | 199 | <field name="type">form</field> |
2660 | 200 | <field name="arch" type="xml"> | 200 | <field name="arch" type="xml"> |
2661 | 201 | <form string="Magento Product Attributes Groups"> | 201 | <form string="Magento Product Attributes Groups"> |
2662 | 202 | <group col="4" colspan="4"> | 202 | <group col="4" colspan="4"> |
2663 | 203 | <field name="attribute_group_name" /> | 203 | <field name="attribute_group_name" /> |
2664 | 204 | <field name="attribute_set" /> | 204 | <field name="attribute_set" /> |
2665 | 205 | <field name="default_id" /> | 205 | <field name="default_id" /> |
2666 | 206 | <field name="sort_order" /> | 206 | <field name="sort_order" /> |
2667 | 207 | </group> | 207 | </group> |
2668 | 208 | </form> | 208 | </form> |
2669 | 209 | </field> | 209 | </field> |
2670 | 210 | </record> | 210 | </record> |
2671 | 211 | <record model="ir.ui.view" id="magerp_product_attribute_groups_tree"> | 211 | <record model="ir.ui.view" id="magerp_product_attribute_groups_tree"> |
2672 | 212 | <field name="name">magerp.product_attribute_groups.tree</field> | 212 | <field name="name">magerp.product_attribute_groups.tree</field> |
2673 | 213 | <field name="model">magerp.product_attribute_groups</field> | 213 | <field name="model">magerp.product_attribute_groups</field> |
2674 | 214 | <field name="type">tree</field> | 214 | <field name="type">tree</field> |
2675 | 215 | <field name="arch" type="xml"> | 215 | <field name="arch" type="xml"> |
2676 | 216 | <tree string="Magento Product Attribute groups"> | 216 | <tree string="Magento Product Attribute groups"> |
2677 | 217 | <field name="attribute_group_name" select="1" /> | 217 | <field name="attribute_group_name" select="1" /> |
2678 | 218 | <field name="attribute_set" select="2" /> | 218 | <field name="attribute_set" select="2" /> |
2679 | 219 | <field name="default_id" select="2" /> | 219 | <field name="default_id" select="2" /> |
2680 | 220 | <field name="sort_order" select="2" /> | 220 | <field name="sort_order" select="2" /> |
2681 | 221 | </tree> | 221 | </tree> |
2682 | 222 | </field> | 222 | </field> |
2683 | 223 | </record> | 223 | </record> |
2684 | 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"> |
2685 | 225 | <field name="name">Magento Product Attribute Groups</field> | 225 | <field name="name">Magento Product Attribute Groups</field> |
2686 | 226 | <field name="res_model">magerp.product_attribute_groups</field> | 226 | <field name="res_model">magerp.product_attribute_groups</field> |
2687 | 227 | <field name="src_model">magerp.product_attribute_groups</field> | 227 | <field name="src_model">magerp.product_attribute_groups</field> |
2688 | 228 | <field name="type">ir.actions.act_window</field> | 228 | <field name="type">ir.actions.act_window</field> |
2689 | 229 | <field name="view_type">form</field> | 229 | <field name="view_type">form</field> |
2690 | 230 | <field name="view_mode">tree,form</field> | 230 | <field name="view_mode">tree,form</field> |
2691 | 231 | <field name="view_id" ref="magerp_product_attribute_groups_tree" /> | 231 | <field name="view_id" ref="magerp_product_attribute_groups_tree" /> |
2692 | 232 | </record> | 232 | </record> |
2693 | 233 | 233 | ||
2694 | 234 | <!-- This is a product inherited form that will be dynamically populated--> | 234 | <!-- This is a product inherited form that will be dynamically populated--> |
2695 | 235 | <record model="ir.ui.view" id="product_product_form_view_magerp"> | 235 | <record model="ir.ui.view" id="product_product_form_view_magerp"> |
2696 | 236 | <field name="name">product.normal.form_magerp</field> | 236 | <field name="name">product.normal.form_magerp</field> |
2697 | 237 | <field name="model">product.product</field> | 237 | <field name="model">product.product</field> |
2698 | 238 | <field name="inherit_id" ref="product.product_normal_form_view" /> | 238 | <field name="inherit_id" ref="product.product_normal_form_view" /> |
2699 | 239 | <field name="type">form</field> | 239 | <field name="type">form</field> |
2700 | 240 | <field name="arch" type="xml"> | 240 | <field name="arch" type="xml"> |
2701 | 241 | <data> | 241 | <data> |
2702 | 242 | <xpath expr="/form/group/group/field[@name='ean13']" position="after"> | 242 | <xpath expr="/form/group/group/field[@name='ean13']" position="after"> |
2703 | 243 | <field name="magento_exported" invisible="True"/> | 243 | <field name="magento_exported" invisible="True"/> |
2728 | 244 | </xpath> | 244 | </xpath> |
2729 | 245 | <xpath expr="/form/group/group/field[@name='variants']" position="after"> | 245 | <xpath expr="/form/group/group/field[@name='variants']" position="after"> |
2730 | 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)]}"/> |
2731 | 247 | </xpath> | 247 | </xpath> |
2732 | 248 | <xpath expr="/form/group/group/field[@name='sale_ok']" position="before"> | 248 | <xpath expr="/form/group/group/field[@name='sale_ok']" position="before"> |
2733 | 249 | <button name="open_magento_fields"/> | 249 | <button name="open_magento_fields"/> |
2734 | 250 | </xpath> | 250 | </xpath> |
2735 | 251 | <xpath expr="/form/notebook" position="before"> | 251 | <xpath expr="/form/notebook" position="before"> |
2736 | 252 | <field name="magento_exportable" select="2"/> | 252 | <field name="magento_exportable" select="2"/> |
2737 | 253 | </xpath> | 253 | </xpath> |
2738 | 254 | </data> | 254 | </data> |
2739 | 255 | </field> | 255 | </field> |
2740 | 256 | </record> | 256 | </record> |
2741 | 257 | <record model="ir.ui.view" id="product_product_form_view_magerpdynamic"> | 257 | <record model="ir.ui.view" id="product_product_form_view_magerpdynamic"> |
2742 | 258 | <field name="name">product.normal.form_magerp_dynamic</field> | 258 | <field name="name">product.normal.form_magerp_dynamic</field> |
2743 | 259 | <field name="model">product.product</field> | 259 | <field name="model">product.product</field> |
2744 | 260 | <field name="inherit_id" ref="product.product_normal_form_view" /> | 260 | <field name="inherit_id" ref="product.product_normal_form_view" /> |
2745 | 261 | <field name="type">form</field> | 261 | <field name="type">form</field> |
2746 | 262 | <field name="arch" type="xml"> | 262 | <field name="arch" type="xml"> |
2747 | 263 | <xpath expr="/form/notebook" position="inside"> | 263 | <xpath expr="/form/notebook" position="inside"> |
2748 | 264 | <page string="attributes_placeholder"/> | 264 | <page string="attributes_placeholder"/> |
2749 | 265 | </xpath> | 265 | </xpath> |
2750 | 266 | </field> | 266 | </field> |
2751 | 267 | </record> | 267 | </record> |
2752 | 268 | 268 | ||
2753 | 269 | <!--Magento Product Product Wizard Form view--> | 269 | <!--Magento Product Product Wizard Form view--> |
2754 | 270 | 270 | ||
2755 | @@ -293,34 +293,34 @@ | |||
2756 | 293 | </field> | 293 | </field> |
2757 | 294 | </record> | 294 | </record> |
2758 | 295 | 295 | ||
2767 | 296 | <!--Magento Product Type Tree/Form view --> | 296 | <!--Magento Product Type Tree/Form view --> |
2768 | 297 | <record model="ir.ui.view" id="magerp_product_type_form"> | 297 | <record model="ir.ui.view" id="magerp_product_type_form"> |
2769 | 298 | <field name="name">magerp.product_product_type.form</field> | 298 | <field name="name">magerp.product_product_type.form</field> |
2770 | 299 | <field name="model">magerp.product_product_type</field> | 299 | <field name="model">magerp.product_product_type</field> |
2771 | 300 | <field name="type">form</field> | 300 | <field name="type">form</field> |
2772 | 301 | <field name="priority" eval="5"/> | 301 | <field name="priority" eval="5"/> |
2773 | 302 | <field name="arch" type="xml"> | 302 | <field name="arch" type="xml"> |
2774 | 303 | <form string="Product Type"> | 303 | <form string="Product Type"> |
2775 | 304 | <field name="product_type"/> | 304 | <field name="product_type"/> |
2776 | 305 | <field name="name"/> | 305 | <field name="name"/> |
2777 | 306 | <field name="default_type"/> | 306 | <field name="default_type"/> |
2791 | 307 | </form> | 307 | </form> |
2792 | 308 | </field> | 308 | </field> |
2793 | 309 | </record> | 309 | </record> |
2794 | 310 | 310 | ||
2795 | 311 | <record model="ir.ui.view" id="magerp_product_type_tree"> | 311 | <record model="ir.ui.view" id="magerp_product_type_tree"> |
2796 | 312 | <field name="name">magerp.product_product_type.tree</field> | 312 | <field name="name">magerp.product_product_type.tree</field> |
2797 | 313 | <field name="model">magerp.product_product_type</field> | 313 | <field name="model">magerp.product_product_type</field> |
2798 | 314 | <field name="type">tree</field> | 314 | <field name="type">tree</field> |
2799 | 315 | <field name="priority" eval="5"/> | 315 | <field name="priority" eval="5"/> |
2800 | 316 | <field name="arch" type="xml"> | 316 | <field name="arch" type="xml"> |
2801 | 317 | <tree string="Product Type" editable="top"> | 317 | <tree string="Product Type" editable="top"> |
2802 | 318 | <field name="name" select="1"/> | 318 | <field name="name" select="1"/> |
2803 | 319 | <field name="product_type" select="1"/> | 319 | <field name="product_type" select="1"/> |
2804 | 320 | <field name="default_type" select="1"/> | 320 | <field name="default_type" select="1"/> |
2808 | 321 | </tree> | 321 | </tree> |
2809 | 322 | </field> | 322 | </field> |
2810 | 323 | </record> | 323 | </record> |
2811 | 324 | 324 | ||
2812 | 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"> |
2813 | 326 | <field name="name">Product Types</field> | 326 | <field name="name">Product Types</field> |
2814 | @@ -331,43 +331,43 @@ | |||
2815 | 331 | 331 | ||
2816 | 332 | 332 | ||
2817 | 333 | <!--Magento product_category attribute_option Tree/Form view --> | 333 | <!--Magento product_category attribute_option Tree/Form view --> |
2849 | 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"> |
2850 | 335 | <field name="name">magerp.product_category_attribute_options.form</field> | 335 | <field name="name">magerp.product_category_attribute_options.form</field> |
2851 | 336 | <field name="model">magerp.product_category_attribute_options</field> | 336 | <field name="model">magerp.product_category_attribute_options</field> |
2852 | 337 | <field name="type">form</field> | 337 | <field name="type">form</field> |
2853 | 338 | <field name="arch" type="xml"> | 338 | <field name="arch" type="xml"> |
2854 | 339 | <form string="Magento Product Category Attribute Option"> | 339 | <form string="Magento Product Category Attribute Option"> |
2855 | 340 | <group col="4" colspan="4"> | 340 | <group col="4" colspan="4"> |
2856 | 341 | <field name="attribute_name" /> | 341 | <field name="attribute_name" /> |
2857 | 342 | <field name="label" /> | 342 | <field name="label" /> |
2858 | 343 | <field name="value" /> | 343 | <field name="value" /> |
2859 | 344 | </group> | 344 | </group> |
2860 | 345 | </form> | 345 | </form> |
2861 | 346 | </field> | 346 | </field> |
2862 | 347 | </record> | 347 | </record> |
2863 | 348 | 348 | ||
2864 | 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"> |
2865 | 350 | <field name="name">magerp.product_category_attribute_options.tree</field> | 350 | <field name="name">magerp.product_category_attribute_options.tree</field> |
2866 | 351 | <field name="model">magerp.product_category_attribute_options</field> | 351 | <field name="model">magerp.product_category_attribute_options</field> |
2867 | 352 | <field name="type">tree</field> | 352 | <field name="type">tree</field> |
2868 | 353 | <field name="arch" type="xml"> | 353 | <field name="arch" type="xml"> |
2869 | 354 | <tree string="Magento Product Category Attribute Option"> | 354 | <tree string="Magento Product Category Attribute Option"> |
2870 | 355 | <field name="attribute_name" /> | 355 | <field name="attribute_name" /> |
2871 | 356 | <field name="label" /> | 356 | <field name="label" /> |
2872 | 357 | <field name="value" /> | 357 | <field name="value" /> |
2873 | 358 | </tree> | 358 | </tree> |
2874 | 359 | </field> | 359 | </field> |
2875 | 360 | </record> | 360 | </record> |
2876 | 361 | 361 | ||
2877 | 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"> |
2878 | 363 | <field name="name">Magento Product Category Attribute Options</field> | 363 | <field name="name">Magento Product Category Attribute Options</field> |
2879 | 364 | <field name="res_model">magerp.product_category_attribute_options</field> | 364 | <field name="res_model">magerp.product_category_attribute_options</field> |
2880 | 365 | <field name="src_model">magerp.product_category_attribute_options</field> | 365 | <field name="src_model">magerp.product_category_attribute_options</field> |
2886 | 366 | <field name="type">ir.actions.act_window</field> | 366 | <field name="type">ir.actions.act_window</field> |
2887 | 367 | <field name="view_type">form</field> | 367 | <field name="view_type">form</field> |
2888 | 368 | <field name="view_mode">tree,form</field> | 368 | <field name="view_mode">tree,form</field> |
2889 | 369 | <field name="view_id" ref="magerp_product_category_attribute_options_tree" /> | 369 | <field name="view_id" ref="magerp_product_category_attribute_options_tree" /> |
2890 | 370 | </record> | 370 | </record> |
2891 | 371 | 371 | ||
2892 | 372 | <!--Magento attribute_option Search/Tree/Form view --> | 372 | <!--Magento attribute_option Search/Tree/Form view --> |
2893 | 373 | 373 | ||
2894 | @@ -433,5 +433,5 @@ | |||
2895 | 433 | <field name="search_view_id" ref="magerp_product_attribute_options_search"/> | 433 | <field name="search_view_id" ref="magerp_product_attribute_options_search"/> |
2896 | 434 | </record> | 434 | </record> |
2897 | 435 | 435 | ||
2899 | 436 | </data> | 436 | </data> |
2900 | 437 | </openerp> | 437 | </openerp> |
2901 | 438 | 438 | ||
2902 | === modified file 'magentoerpconnect/sale.py' | |||
2903 | --- magentoerpconnect/sale.py 2012-08-20 09:39:45 +0000 | |||
2904 | +++ magentoerpconnect/sale.py 2012-12-03 15:22:20 +0000 | |||
2905 | @@ -22,17 +22,16 @@ | |||
2906 | 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/>. # |
2907 | 23 | ######################################################################### | 23 | ######################################################################### |
2908 | 24 | 24 | ||
2912 | 25 | from osv import osv, fields | 25 | from openerp.osv.orm import Model |
2913 | 26 | import pooler | 26 | from openerp.osv import fields |
2914 | 27 | import magerp_osv | 27 | from openerp.osv.osv import except_osv |
2915 | 28 | import netsvc | 28 | import netsvc |
2916 | 29 | from tools.translate import _ | 29 | from tools.translate import _ |
2919 | 30 | import string | 30 | from openerp import tools |
2918 | 31 | import tools | ||
2920 | 32 | import time | 31 | import time |
2921 | 33 | from tools import DEFAULT_SERVER_DATETIME_FORMAT | 32 | from tools import DEFAULT_SERVER_DATETIME_FORMAT |
2922 | 34 | from base_external_referentials.external_osv import ExternalSession | 33 | from base_external_referentials.external_osv import ExternalSession |
2924 | 35 | from base_external_referentials.decorator import only_for_referential | 34 | from base_external_referentials.decorator import only_for_referential, open_report |
2925 | 36 | 35 | ||
2926 | 37 | #from base_external_referentials import report | 36 | #from base_external_referentials import report |
2927 | 38 | 37 | ||
2928 | @@ -54,7 +53,7 @@ | |||
2929 | 54 | 'waiting_date': 'holded'} | 53 | 'waiting_date': 'holded'} |
2930 | 55 | SALE_ORDER_IMPORT_STEP = 200 | 54 | SALE_ORDER_IMPORT_STEP = 200 |
2931 | 56 | 55 | ||
2933 | 57 | class sale_shop(osv.osv): | 56 | class sale_shop(Model): |
2934 | 58 | _inherit = "sale.shop" | 57 | _inherit = "sale.shop" |
2935 | 59 | 58 | ||
2936 | 60 | @only_for_referential('magento') | 59 | @only_for_referential('magento') |
2937 | @@ -71,14 +70,16 @@ | |||
2938 | 71 | context['lang_to_export'].append(storeview.lang_id.code) | 70 | context['lang_to_export'].append(storeview.lang_id.code) |
2939 | 72 | return context | 71 | return context |
2940 | 73 | 72 | ||
2941 | 74 | |||
2942 | 75 | |||
2943 | 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): |
2944 | 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) |
2945 | 78 | for shop_id in res: | 75 | for shop_id in res: |
2946 | 79 | website_id = self.read(cr, uid, shop_id, ['shop_group_id']) | 76 | website_id = self.read(cr, uid, shop_id, ['shop_group_id']) |
2947 | 80 | if website_id.get('shop_group_id', False): | 77 | if website_id.get('shop_group_id', False): |
2949 | 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, |
2950 | 79 | [('magento_exportable', '=', True), | ||
2951 | 80 | ('id', 'in', res[shop_id]), | ||
2952 | 81 | "|", ('websites_ids', 'in', [website_id['shop_group_id'][0]]), | ||
2953 | 82 | ('websites_ids', '=', False)]) | ||
2954 | 82 | else: | 83 | else: |
2955 | 83 | res[shop_id] = [] | 84 | res[shop_id] = [] |
2956 | 84 | return res | 85 | return res |
2957 | @@ -138,7 +139,10 @@ | |||
2958 | 138 | if model_data_id: | 139 | if model_data_id: |
2959 | 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) |
2960 | 140 | else: | 141 | else: |
2962 | 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!'), |
2963 | 143 | _('No external id found, are you sure that the referential are syncronized? ' | ||
2964 | 144 | 'Please contact your administrator. ' | ||
2965 | 145 | '(more information in magentoerpconnect/sale.py)')) | ||
2966 | 142 | return True | 146 | return True |
2967 | 143 | 147 | ||
2968 | 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): |
2969 | @@ -155,6 +159,11 @@ | |||
2970 | 155 | defaults.update({'magento_shop' : True}) | 159 | defaults.update({'magento_shop' : True}) |
2971 | 156 | return defaults | 160 | return defaults |
2972 | 157 | 161 | ||
2973 | 162 | @only_for_referential('magento') | ||
2974 | 163 | @open_report | ||
2975 | 164 | def _export_inventory(self, *args, **kwargs): | ||
2976 | 165 | return super(sale_shop, self)._export_inventory(*args, **kwargs) | ||
2977 | 166 | |||
2978 | 158 | _columns = { | 167 | _columns = { |
2979 | 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 storeviews | 168 | '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 |
2980 | 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"), |
2981 | @@ -234,12 +243,9 @@ | |||
2982 | 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): |
2983 | 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) |
2984 | 236 | 245 | ||
2989 | 237 | sale_shop() | 246 | |
2990 | 238 | 247 | class sale_order(Model): | |
2987 | 239 | |||
2988 | 240 | class sale_order(osv.osv): | ||
2991 | 241 | _inherit = "sale.order" | 248 | _inherit = "sale.order" |
2992 | 242 | |||
2993 | 243 | _columns = { | 249 | _columns = { |
2994 | 244 | 'magento_incrementid': fields.char('Magento Increment ID', size=32), | 250 | 'magento_incrementid': fields.char('Magento Increment ID', size=32), |
2995 | 245 | 'magento_storeview_id': fields.many2one('magerp.storeviews', 'Magento Store View'), | 251 | 'magento_storeview_id': fields.many2one('magerp.storeviews', 'Magento Store View'), |
2996 | @@ -247,7 +253,7 @@ | |||
2997 | 247 | 'shop_id', 'referential_id', 'magento_referential', | 253 | 'shop_id', 'referential_id', 'magento_referential', |
2998 | 248 | type='boolean', | 254 | type='boolean', |
2999 | 249 | string='Is a Magento Sale Order') | 255 | string='Is a Magento Sale Order') |
3001 | 250 | } | 256 | } |
3002 | 251 | 257 | ||
3003 | 252 | def _auto_init(self, cr, context=None): | 258 | def _auto_init(self, cr, context=None): |
3004 | 253 | tools.drop_view_if_exists(cr, 'sale_report') | 259 | tools.drop_view_if_exists(cr, 'sale_report') |
3005 | @@ -323,7 +329,7 @@ | |||
3006 | 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) |
3007 | 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,)) |
3008 | 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) |
3010 | 326 | except osv.except_osv, e: | 332 | except except_osv, e: |
3011 | 327 | #TODO: generic reporting of errors in magentoerpconnect | 333 | #TODO: generic reporting of errors in magentoerpconnect |
3012 | 328 | # except if the sale order has been confirmed for example, we cannot cancel the order | 334 | # except if the sale order has been confirmed for example, we cannot cancel the order |
3013 | 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'] |
3014 | @@ -384,7 +390,7 @@ | |||
3015 | 384 | resource['lastname'] = resource['customer_lastname'] | 390 | resource['lastname'] = resource['customer_lastname'] |
3016 | 385 | resource['email'] = resource['customer_email'] | 391 | resource['email'] = resource['customer_email'] |
3017 | 386 | 392 | ||
3019 | 387 | shop = self.pool.get('sale.shop').browse(cr, uid, defaults['shop_id'], context=context) | 393 | shop = external_session.sync_from_object |
3020 | 388 | partner_defaults = {'website_id': shop.shop_group_id.id} | 394 | partner_defaults = {'website_id': shop.shop_group_id.id} |
3021 | 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,\ |
3022 | 390 | mapping=mapping, defaults=partner_defaults, context=context) | 396 | mapping=mapping, defaults=partner_defaults, context=context) |
3023 | @@ -401,14 +407,17 @@ | |||
3024 | 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): |
3025 | 402 | resource = self.clean_magento_resource(cr, uid, resource, context=context) | 408 | resource = self.clean_magento_resource(cr, uid, resource, context=context) |
3026 | 403 | resource = self.clean_magento_items(cr, uid, resource, context=context) | 409 | resource = self.clean_magento_items(cr, uid, resource, context=context) |
3035 | 404 | if not resource['customer_id']: | 410 | for line in mapping[mapping_id]['mapping_lines']: |
3036 | 405 | #If there is not partner it's a guest order | 411 | if line['name'] == 'customer_id' and not resource.get('customer_id'): |
3037 | 406 | #So we remove the useless information | 412 | #If there is not partner it's a guest order |
3038 | 407 | #And create a partner on fly and set the data in the default value | 413 | #So we remove the useless information |
3039 | 408 | del resource['customer_id'] | 414 | #And create a partner on fly and set the data in the default value |
3040 | 409 | del resource['billing_address']['customer_id'] | 415 | #We only do this if the customer_id is in the mapping line |
3041 | 410 | del resource['shipping_address']['customer_id'] | 416 | #Indeed when we check if a sale order exist only the name is asked for convertion |
3042 | 411 | defaults = self.create_onfly_partner(cr, uid, external_session, resource, mapping, defaults, context=context) | 417 | resource.pop('customer_id', None) |
3043 | 418 | resource['billing_address'].pop('customer_id', None) | ||
3044 | 419 | resource['shipping_address'].pop('customer_id', None) | ||
3045 | 420 | defaults = self.create_onfly_partner(cr, uid, external_session, resource, mapping, defaults, context=context) | ||
3046 | 412 | 421 | ||
3047 | 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,\ |
3048 | 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,\ |
3049 | @@ -624,7 +633,7 @@ | |||
3050 | 624 | # in the sale order and sometime it's equal to NONE in the address but at least the | 633 | # in the sale order and sometime it's equal to NONE in the address but at least the |
3051 | 625 | # the information is correct in one of this field | 634 | # the information is correct in one of this field |
3052 | 626 | # So I make this ugly code to try to fix it. | 635 | # So I make this ugly code to try to fix it. |
3054 | 627 | if not resource['customer_id']: | 636 | if not resource.get('customer_id'): |
3055 | 628 | if resource['billing_address'].get('customer_id'): | 637 | if resource['billing_address'].get('customer_id'): |
3056 | 629 | resource['customer_id'] = resource['billing_address']['customer_id'] | 638 | resource['customer_id'] = resource['billing_address']['customer_id'] |
3057 | 630 | else: | 639 | else: |
3058 | @@ -634,13 +643,9 @@ | |||
3059 | 634 | resource['shipping_address']['customer_id'] = resource['customer_id'] | 643 | resource['shipping_address']['customer_id'] = resource['customer_id'] |
3060 | 635 | return resource | 644 | return resource |
3061 | 636 | 645 | ||
3067 | 637 | sale_order() | 646 | |
3068 | 638 | 647 | class sale_order_line(Model): | |
3064 | 639 | |||
3065 | 640 | class sale_order_line(osv.osv): | ||
3066 | 641 | |||
3069 | 642 | _inherit = 'sale.order.line' | 648 | _inherit = 'sale.order.line' |
3070 | 643 | |||
3071 | 644 | _columns = { | 649 | _columns = { |
3072 | 645 | # Rised the precision of the sale.order.line discount field | 650 | # Rised the precision of the sale.order.line discount field |
3073 | 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. |
3074 | @@ -649,7 +654,5 @@ | |||
3075 | 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. |
3076 | 650 | # Rise the digits to 3 allows to have 50.167% => 149€ | 655 | # Rise the digits to 3 allows to have 50.167% => 149€ |
3077 | 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)]}), |
3081 | 652 | } | 657 | } |
3079 | 653 | |||
3080 | 654 | sale_order_line() | ||
3082 | 655 | 658 | ||
3083 | 656 | 659 | ||
3084 | === modified file 'magentoerpconnect/sale_view.xml' | |||
3085 | --- magentoerpconnect/sale_view.xml 2012-08-14 09:18:30 +0000 | |||
3086 | +++ magentoerpconnect/sale_view.xml 2012-12-03 15:22:20 +0000 | |||
3087 | @@ -1,45 +1,75 @@ | |||
3088 | 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
3089 | 2 | <openerp> | 2 | <openerp> |
3130 | 3 | <data> | 3 | <data> |
3131 | 4 | 4 | ||
3132 | 5 | <record model="ir.ui.view" id="magerp_view_shop_form"> | 5 | |
3133 | 6 | <field name="name">magerp_view_shop_form</field> | 6 | <record model="ir.ui.view" id="magerp_view_shop_form"> |
3134 | 7 | <field name="model">sale.shop</field> | 7 | <field name="name">magerp_view_shop_form</field> |
3135 | 8 | <field name="inherit_id" | 8 | <field name="model">sale.shop</field> |
3136 | 9 | ref="base_sale_multichannels.base_sale_multichannels_view_shop_form" /> | 9 | <field name="inherit_id" |
3137 | 10 | <field name="type">form</field> | 10 | ref="base_sale_multichannels.base_sale_multichannels_view_shop_form" /> |
3138 | 11 | <field name="arch" type="xml"> | 11 | <field name="type">form</field> |
3139 | 12 | <data> | 12 | <field name="arch" type="xml"> |
3140 | 13 | <field name="referential_id" position="replace"> | 13 | <field name="referential_id" position="replace"> |
3141 | 14 | <field name="referential_id" attrs="{'readonly': [('magento_shop','=',True)]}"/> | 14 | <field name="referential_id" attrs="{'readonly': [('type_name', '=', 'Magento')]}"/> |
3142 | 15 | </field> | 15 | </field> |
3143 | 16 | <field name="shop_group_id" position="replace"> | 16 | <page string="External Shop Settings" position="before"> |
3144 | 17 | <field name="shop_group_id" readonly="True"/> | 17 | <page string="Magento Actions" attrs="{'invisible': [('type_name', '!=', 'Magento')]}"> |
3145 | 18 | <field name="magento_root_category"/> | 18 | <group col="6" colspan="4"> |
3146 | 19 | <field name="storeview_ids" nolabel="1" colspan="4"/> | 19 | <group col="3" colspan="3"> |
3147 | 20 | <separator string="Magento Option" colspan="4"/> | 20 | <separator string="Catalog" colspan="3"/> |
3148 | 21 | <field name="magento_shop" /> | 21 | <group col="1" colspan="1"> |
3149 | 22 | <field name="allow_magento_order_status_push" /> | 22 | <button name="export_catalog" string="Export Catalog" colspan="1" type="object"/> |
3150 | 23 | <field name="allow_magento_notification"/> | 23 | <button name="export_inventory" string="Export Stock Levels Only" colspan="1" type="object"/> |
3151 | 24 | </field> | 24 | <button name="export_images" string="Export Images" colspan="2" type="object" /> |
3152 | 25 | <button name="export_inventory" position="after"> | 25 | </group> |
3153 | 26 | <button name="export_images" string="Export Images" colspan="2" type="object" /> | 26 | <group col="2" colspan="2"> |
3154 | 27 | </button> | 27 | <field name="last_products_export_date" colspan="2"/> |
3155 | 28 | <field name="last_inventory_export_date" position="after"> | 28 | <field name="last_special_products_export_date" colspan="2"/> |
3156 | 29 | <field name="last_images_export_date" /> | 29 | <field name="last_category_export_date" colspan="2"/> |
3157 | 30 | </field> | 30 | <field name="last_inventory_export_date" colspan="2"/> |
3158 | 31 | </data> | 31 | <field name="last_images_export_date" /> |
3159 | 32 | </field> | 32 | </group> |
3160 | 33 | </record> | 33 | </group> |
3161 | 34 | 34 | <group col="3" colspan="3"> | |
3162 | 35 | <record id="act_magerp_shop_form" model="ir.actions.act_window"> | 35 | <separator string="Orders" colspan="3"/> |
3163 | 36 | <field name="name">Magento Shops</field> | 36 | <group col="4" colspan="3"> |
3164 | 37 | <field name="res_model">sale.shop</field> | 37 | <button name="import_orders" string="Import Orders" colspan="1" type="object"/> |
3165 | 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"/> |
3166 | 39 | <field name="view_type">form</field> | 39 | <field name="import_orders_from_date" colspan="2"/> |
3167 | 40 | <field name="view_mode">tree,form</field> | 40 | </group> |
3168 | 41 | <field name="domain">[('magento_shop', '=', True)]</field> | 41 | <button name="update_orders" string="Update Orders State on Channel" colspan="1" type="object"/> |
3169 | 42 | </record> | 42 | <field name="last_update_order_export_date" colspan="2"/> |
3170 | 43 | <button name="export_invoices" string="Export Invoices" colspan="1" type="object"/> | ||
3171 | 44 | <button name="export_shipping" string="Export Shippings" colspan="1" type="object"/> | ||
3172 | 45 | </group> | ||
3173 | 46 | <separator string="Partners" colspan="3"/> | ||
3174 | 47 | <newline/> | ||
3175 | 48 | <button name="export_shop_partners" string="Export Partners" colspan="1" type="object"/> | ||
3176 | 49 | <newline/> | ||
3177 | 50 | </group> | ||
3178 | 51 | </page> | ||
3179 | 52 | </page> | ||
3180 | 53 | <field name="shop_group_id" position="replace"> | ||
3181 | 54 | <field name="shop_group_id" readonly="True"/> | ||
3182 | 55 | <field name="magento_root_category"/> | ||
3183 | 56 | <field name="storeview_ids" nolabel="1" colspan="4"/> | ||
3184 | 57 | <separator string="Magento Option" colspan="4"/> | ||
3185 | 58 | <field name="magento_shop" /> | ||
3186 | 59 | <field name="allow_magento_order_status_push" /> | ||
3187 | 60 | <field name="allow_magento_notification"/> | ||
3188 | 61 | </field> | ||
3189 | 62 | </field> | ||
3190 | 63 | </record> | ||
3191 | 64 | |||
3192 | 65 | <record id="act_magerp_shop_form" model="ir.actions.act_window"> | ||
3193 | 66 | <field name="name">Magento Shops</field> | ||
3194 | 67 | <field name="res_model">sale.shop</field> | ||
3195 | 68 | <field name="type">ir.actions.act_window</field> | ||
3196 | 69 | <field name="view_type">form</field> | ||
3197 | 70 | <field name="view_mode">tree,form</field> | ||
3198 | 71 | <field name="domain">[['type_name', '=', 'Magento']]</field> | ||
3199 | 72 | </record> | ||
3200 | 43 | 73 | ||
3201 | 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"> |
3202 | 45 | <field name="name">base_sale_multichannel_view_order_form.magento</field> | 75 | <field name="name">base_sale_multichannel_view_order_form.magento</field> |
3203 | @@ -59,6 +89,6 @@ | |||
3204 | 59 | </data> | 89 | </data> |
3205 | 60 | </field> | 90 | </field> |
3206 | 61 | </record> | 91 | </record> |
3209 | 62 | 92 | ||
3210 | 63 | </data> | 93 | </data> |
3211 | 64 | </openerp> | 94 | </openerp> |
3212 | 65 | 95 | ||
3213 | === removed file 'magentoerpconnect/server_tmp.patch' | |||
3214 | --- magentoerpconnect/server_tmp.patch 2011-07-08 07:34:47 +0000 | |||
3215 | +++ magentoerpconnect/server_tmp.patch 1970-01-01 00:00:00 +0000 | |||
3216 | @@ -1,14 +0,0 @@ | |||
3217 | 1 | === modified file 'bin/osv/orm.py' | ||
3218 | 2 | --- bin/osv/orm.py 2011-05-24 10:18:10 +0000 | ||
3219 | 3 | +++ bin/osv/orm.py 2011-06-07 20:17:29 +0000 | ||
3220 | 4 | @@ -2449,6 +2450,9 @@ | ||
3221 | 5 | if k.startswith('x_') and not update_custom_fields: | ||
3222 | 6 | continue | ||
3223 | 7 | |||
3224 | 8 | + if k.startswith('x_js_'): | ||
3225 | 9 | + continue | ||
3226 | 10 | + | ||
3227 | 11 | f = self._columns[k] | ||
3228 | 12 | |||
3229 | 13 | if isinstance(f, fields.one2many): | ||
3230 | 14 | |||
3231 | 15 | 0 | ||
3232 | === modified file 'magentoerpconnect/settings/1.3.2.4/external.mappinglines.template.csv' | |||
3233 | --- magentoerpconnect/settings/1.3.2.4/external.mappinglines.template.csv 2012-05-24 19:50:22 +0000 | |||
3234 | +++ magentoerpconnect/settings/1.3.2.4/external.mappinglines.template.csv 2012-12-03 15:22:20 +0000 | |||
3235 | @@ -41,16 +41,16 @@ | |||
3236 | 41 | clean = re.sub('\w:\w:|\w:\w+;', '', ifield) | 41 | clean = re.sub('\w:\w:|\w:\w+;', '', ifield) |
3237 | 42 | for each in clean.split('{'): | 42 | for each in clean.split('{'): |
3238 | 43 | if each.startswith('""label""'): | 43 | if each.startswith('""label""'): |
3240 | 44 | split_info = each.split(';') | 44 | split_info = each.split(';') |
3241 | 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'])) |
3243 | 46 | 46 | ||
3244 | 47 | result=[('notes', """".join(options_label).replace('""""', '\n').replace('""', ''))] | 47 | result=[('notes', """".join(options_label).replace('""""', '\n').replace('""', ''))] |
3245 | 48 | ", | 48 | ", |
3246 | 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'] |
3247 | 50 | result=[('product_id',self.pool.get('product.product').extid_to_oeid(cr, uid, external_session, ifield, referential_id))]", | 50 | result=[('product_id',self.pool.get('product.product').extid_to_oeid(cr, uid, external_session, ifield, referential_id))]", |
3248 | 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)]", |
3249 | 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)]", |
3251 | 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): |
3252 | 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']))] |
3253 | 55 | else: | 55 | else: |
3254 | 56 | result=[('price_unit', float(data['row_total'])/float(data['qty_ordered']))]", | 56 | result=[('price_unit', float(data['row_total'])/float(data['qty_ordered']))]", |
3255 | @@ -60,16 +60,16 @@ | |||
3256 | 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))]) |
3257 | 61 | parent_id = False | 61 | parent_id = False |
3258 | 62 | if record_id: | 62 | if record_id: |
3261 | 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],[]) |
3262 | 64 | parent_id=parent_rec.get('res_id',False) | 64 | parent_id=parent_rec.get('res_id',False) |
3263 | 65 | result=[('magento_parent_id',ifield),('parent_id',parent_id)]","magento_parent_id = False | 65 | result=[('magento_parent_id',ifield),('parent_id',parent_id)]","magento_parent_id = False |
3264 | 66 | if record.get('parent_id',False): | 66 | if record.get('parent_id',False): |
3269 | 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) |
3270 | 68 | if not magento_parent_id: | 68 | if not magento_parent_id: |
3271 | 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) |
3272 | 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) |
3273 | 71 | if magento_parent_id: | 71 | if magento_parent_id: |
3275 | 72 | result = [('parent_id',magento_parent_id)]" | 72 | result = [('parent_id',magento_parent_id)]" |
3276 | 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'])]" |
3277 | 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'])]" |
3278 | 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'])]" |
3279 | @@ -102,20 +102,20 @@ | |||
3280 | 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)]", |
3281 | 103 | "mag_1324_erp_procat_15","magento1324","product.model_product_category","image",,"in_out","function","unicode",,"image_binary = False | 103 | "mag_1324_erp_procat_15","magento1324","product.model_product_category","image",,"in_out","function","unicode",,"image_binary = False |
3282 | 104 | if ifield and not ifield=='None': | 104 | if ifield and not ifield=='None': |
3290 | 105 | try: | 105 | try: |
3291 | 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'])]) |
3292 | 107 | except Exception, e: | 107 | except Exception, e: |
3293 | 108 | print e | 108 | print e |
3294 | 109 | pass | 109 | pass |
3295 | 110 | if image_binary: | 110 | if image_binary: |
3296 | 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'])) |
3297 | 112 | result=[('image_name',ifield),('image',image_binary)]","if record['image']: | 112 | result=[('image_name',ifield),('image',image_binary)]","if record['image']: |
3300 | 113 | img = base64.decodestring(record['image']) | 113 | img = base64.decodestring(record['image']) |
3301 | 114 | img_bin_enc = base64.encodestring(img) | 114 | img_bin_enc = base64.encodestring(img) |
3302 | 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]) |
3304 | 116 | result = [('image',record['image_name'])] | 116 | result = [('image',record['image_name'])] |
3305 | 117 | else: | 117 | else: |
3307 | 118 | result=[]" | 118 | result=[]" |
3308 | 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'])]" |
3309 | 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: |
3310 | 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) |
3311 | @@ -226,52 +226,52 @@ | |||
3312 | 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)))]", |
3313 | 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)]) |
3314 | 228 | if result and len(result)==1: | 228 | if result and len(result)==1: |
3316 | 229 | result=[('country_id',result[0])] | 229 | result=[('country_id',result[0])] |
3317 | 230 | else: | 230 | else: |
3319 | 231 | result=[] | 231 | result=[] |
3320 | 232 | ", | 232 | ", |
3321 | 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: |
3326 | 234 | if len(ifield.split('\n')) ==2 : | 234 | if len(ifield.split('\n')) ==2 : |
3327 | 235 | result = [('street', ifield.split('\n')[0]) , ('street2', ifield.split('\n')[1])] | 235 | result = [('street', ifield.split('\n')[0]) , ('street2', ifield.split('\n')[1])] |
3328 | 236 | else : | 236 | else : |
3329 | 237 | result = [('street',ifield.replace('\\n',','))] | 237 | result = [('street',ifield.replace('\\n',','))] |
3330 | 238 | else: | 238 | else: |
3332 | 239 | result = []", | 239 | result = []", |
3333 | 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)]", |
3334 | 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)]", |
3335 | 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: |
3341 | 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)]) |
3342 | 244 | if result and len(result)==1: | 244 | if result and len(result)==1: |
3343 | 245 | result = [('state_id',result[0])] | 245 | result = [('state_id',result[0])] |
3344 | 246 | else: | 246 | else: |
3345 | 247 | result=[] | 247 | result=[] |
3346 | 248 | else: | 248 | else: |
3348 | 249 | result=[]", | 249 | result=[]", |
3349 | 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) |
3350 | 251 | if result: | 251 | if result: |
3352 | 252 | result=[('partner_id',result)] | 252 | result=[('partner_id',result)] |
3353 | 253 | else: | 253 | else: |
3355 | 254 | result=[('partner_id',False)]", | 254 | result=[('partner_id',False)]", |
3356 | 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': |
3358 | 256 | result=[('type','invoice')] | 256 | result=[('type','invoice')] |
3359 | 257 | elif ifield=='shipping': | 257 | elif ifield=='shipping': |
3361 | 258 | result=[('type','delivery')] | 258 | result=[('type','delivery')] |
3362 | 259 | else: | 259 | else: |
3364 | 260 | result=[]", | 260 | result=[]", |
3365 | 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)]", |
3366 | 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: |
3370 | 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) |
3371 | 264 | if result: | 264 | if result: |
3372 | 265 | result=[('group_id',result)]", | 265 | result=[('group_id',result)]", |
3373 | 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: |
3378 | 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) |
3379 | 268 | if result: | 268 | if result: |
3380 | 269 | lang = self.pool.get('magerp.storeviews').browse(cr, uid, result).lang_id | 269 | lang = self.pool.get('magerp.storeviews').browse(cr, uid, result).lang_id |
3381 | 270 | result=[('store_id',result),('lang',lang and lang.code or False)]", | 270 | result=[('store_id',result),('lang',lang and lang.code or False)]", |
3382 | 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: |
3386 | 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) |
3387 | 273 | if result: | 273 | if result: |
3388 | 274 | result=[('website_id',result)]", | 274 | result=[('website_id',result)]", |
3389 | 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)]", |
3390 | 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)]", |
3391 | 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)]", |
3392 | @@ -281,10 +281,10 @@ | |||
3393 | 281 | result=[('firstname', fn), ('lastname', ln)]" | 281 | result=[('firstname', fn), ('lastname', ln)]" |
3394 | 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)]", |
3395 | 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: |
3397 | 284 | result=[('mag_vat',ifield)] | 284 | result=[('mag_vat',ifield)] |
3398 | 285 | else: | 285 | else: |
3400 | 286 | result=[]", | 286 | result=[]", |
3401 | 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: |
3403 | 288 | result =[('mag_birthday',ifield[:10])] | 288 | result =[('mag_birthday',ifield[:10])] |
3404 | 289 | else: | 289 | else: |
3406 | 290 | result=[]", | 290 | result=[]", |
3407 | 291 | 291 | ||
3408 | === modified file 'magentoerpconnect/settings/1.5.0.0/product.category/external.mappinglines.template.csv' | |||
3409 | --- magentoerpconnect/settings/1.5.0.0/product.category/external.mappinglines.template.csv 2012-05-07 20:54:47 +0000 | |||
3410 | +++ magentoerpconnect/settings/1.5.0.0/product.category/external.mappinglines.template.csv 2012-12-03 15:22:20 +0000 | |||
3411 | @@ -43,17 +43,17 @@ | |||
3412 | 43 | magentoerpconnect.mag1500_product_category_is_anchor,magentoerpconnect.mag1500_product_category,is_anchor,magentoerpconnect.field_product_category_is_anchor,in_out,direct,int,,False,, | 43 | magentoerpconnect.mag1500_product_category_is_anchor,magentoerpconnect.mag1500_product_category,is_anchor,magentoerpconnect.field_product_category_is_anchor,in_out,direct,int,,False,, |
3413 | 44 | magentoerpconnect.mag1500_product_category_image,magentoerpconnect.mag1500_product_category,image,,in_out,function,unicode,,False,"image_binary = False | 44 | magentoerpconnect.mag1500_product_category_image,magentoerpconnect.mag1500_product_category,image,,in_out,function,unicode,,False,"image_binary = False |
3414 | 45 | if resource['image'] and not resource['image']=='None': | 45 | if resource['image'] and not resource['image']=='None': |
3422 | 46 | try: | 46 | try: |
3423 | 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'])]) |
3424 | 48 | except Exception, e: | 48 | except Exception, e: |
3425 | 49 | print e | 49 | print e |
3426 | 50 | pass | 50 | pass |
3427 | 51 | if image_binary: | 51 | if image_binary: |
3428 | 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'])) |
3429 | 53 | result=[('image_name',ifield),('image',image_binary)]","if 'image' in resource: | 53 | result=[('image_name',ifield),('image',image_binary)]","if 'image' in resource: |
3430 | 54 | if resource['image']: | 54 | if resource['image']: |
3431 | 55 | img = base64.decodestring(record['image']) | 55 | img = base64.decodestring(record['image']) |
3433 | 56 | img_bin_enc = base64.encodestring(img) | 56 | img_bin_enc = base64.encodestring(img) |
3434 | 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]) |
3435 | 58 | result = [('image',record['image_name'])] | 58 | result = [('image',record['image_name'])] |
3436 | 59 | else: | 59 | else: |
3437 | 60 | 60 | ||
3438 | === modified file 'magentoerpconnect/settings/1.5.0.0/product/external.mappinglines.template.csv' | |||
3439 | --- magentoerpconnect/settings/1.5.0.0/product/external.mappinglines.template.csv 2012-06-21 16:17:58 +0000 | |||
3440 | +++ magentoerpconnect/settings/1.5.0.0/product/external.mappinglines.template.csv 2012-12-03 15:22:20 +0000 | |||
3441 | @@ -59,7 +59,7 @@ | |||
3442 | 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) |
3443 | 60 | mag_categ_ids.append(mag_categ_id) | 60 | mag_categ_ids.append(mag_categ_id) |
3444 | 61 | result=[('categories', mag_categ_ids)]",, | 61 | result=[('categories', mag_categ_ids)]",, |
3446 | 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: |
3447 | 63 | if resource['x_magerp_special_price']: | 63 | if resource['x_magerp_special_price']: |
3448 | 64 | result = [('special_price', resource['x_magerp_special_price'])] | 64 | result = [('special_price', resource['x_magerp_special_price'])] |
3449 | 65 | else: | 65 | else: |
3450 | 66 | 66 | ||
3451 | === modified file 'magentoerpconnect/settings/1.5.0.0/res.partner.address/external.mappinglines.template.csv' | |||
3452 | --- magentoerpconnect/settings/1.5.0.0/res.partner.address/external.mappinglines.template.csv 2012-05-19 17:26:11 +0000 | |||
3453 | +++ magentoerpconnect/settings/1.5.0.0/res.partner.address/external.mappinglines.template.csv 2012-12-03 15:22:20 +0000 | |||
3454 | @@ -1,5 +1,17 @@ | |||
3455 | 1 | id,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 | 1 | id,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 |
3457 | 2 | magentoerpconnect.mag1500_res_partner_address_name,,in_out,direct,firstname,magentoerpconnect.field_res_partner_address_firstname,unicode,True,magentoerpconnect.mag1500_res_partner_address,name,,,, | 2 | magentoerpconnect.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: |
3458 | 3 | result = [('name', (resource.get('firstname') or '') + (resource.get('firstname') and ' ' or '') + (resource.get('lastname') or ''))]","if 'name' in resource: | ||
3459 | 4 | name_split = name.split(' ') | ||
3460 | 5 | if len(name_split) >= 2: | ||
3461 | 6 | firstname = name_split[0] | ||
3462 | 7 | lastname = name.replace(firstname, '').strip() | ||
3463 | 8 | else: | ||
3464 | 9 | firstname = '-' | ||
3465 | 10 | lastname = name | ||
3466 | 11 | else: | ||
3467 | 12 | firstname = '' | ||
3468 | 13 | lastname = '' | ||
3469 | 14 | result = [('firstname', firstname), ('lastname', lastname)]",, | ||
3470 | 3 | magentoerpconnect.mag1500_res_partner_address_telephone,,in_out,direct,telephone,base.field_res_partner_address_phone,unicode,False,magentoerpconnect.mag1500_res_partner_address,,,,, | 15 | magentoerpconnect.mag1500_res_partner_address_telephone,,in_out,direct,telephone,base.field_res_partner_address_phone,unicode,False,magentoerpconnect.mag1500_res_partner_address,,,,, |
3471 | 4 | magentoerpconnect.mag1500_res_partner_address_region,,in_out,function,region,,unicode,False,magentoerpconnect.mag1500_res_partner_address,region,"if ifield: | 16 | magentoerpconnect.mag1500_res_partner_address_region,,in_out,function,region,,unicode,False,magentoerpconnect.mag1500_res_partner_address,region,"if ifield: |
3472 | 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)]) |
3473 | @@ -42,7 +54,6 @@ | |||
3474 | 42 | result = [('prefix',resource['title'][1])]",, | 54 | result = [('prefix',resource['title'][1])]",, |
3475 | 43 | magentoerpconnect.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)]",,, | 55 | magentoerpconnect.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)]",,, |
3476 | 44 | magentoerpconnect.mag1500_res_partner_address_fax,,in_out,direct,fax,base.field_res_partner_address_fax,unicode,False,magentoerpconnect.mag1500_res_partner_address,,,,, | 56 | magentoerpconnect.mag1500_res_partner_address_fax,,in_out,direct,fax,base.field_res_partner_address_fax,unicode,False,magentoerpconnect.mag1500_res_partner_address,,,,, |
3477 | 45 | magentoerpconnect.mag1500_res_partner_address_lastname,,in_out,direct,lastname,magentoerpconnect.field_res_partner_address_lastname,unicode,False,magentoerpconnect.mag1500_res_partner_address,,,,, | ||
3478 | 46 | mag1500_res_partner_address_email,,in_out,direct,email,base.field_res_partner_address_email,unicode,False,magentoerpconnect.mag1500_res_partner_address,,,,, | 57 | mag1500_res_partner_address_email,,in_out,direct,email,base.field_res_partner_address_email,unicode,False,magentoerpconnect.mag1500_res_partner_address,,,,, |
3479 | 47 | mag1500_res_partner_address_company,,in_out,direct,company,magentoerpconnect.field_res_partner_address_company,unicode,True,magentoerpconnect.mag1500_res_partner_address,,,,, | 58 | mag1500_res_partner_address_company,,in_out,direct,company,magentoerpconnect.field_res_partner_address_company,unicode,True,magentoerpconnect.mag1500_res_partner_address,,,,, |
3480 | 48 | magentoerpconnect.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)]",,, | 59 | magentoerpconnect.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)]",,, |
3481 | 49 | 60 | ||
3482 | === modified file 'magentoerpconnect/settings/1.5.0.0/res.partner/external.mappinglines.template.csv' | |||
3483 | --- magentoerpconnect/settings/1.5.0.0/res.partner/external.mappinglines.template.csv 2012-08-14 14:53:28 +0000 | |||
3484 | +++ magentoerpconnect/settings/1.5.0.0/res.partner/external.mappinglines.template.csv 2012-12-03 15:22:20 +0000 | |||
3485 | @@ -11,7 +11,8 @@ | |||
3486 | 11 | mag1500_res_partner_created_in,,in_out,direct,created_in,magentoerpconnect.field_res_partner_created_in,unicode,False,magentoerpconnect.mag1500_res_partner,,,,, | 11 | mag1500_res_partner_created_in,,in_out,direct,created_in,magentoerpconnect.field_res_partner_created_in,unicode,False,magentoerpconnect.mag1500_res_partner,,,,, |
3487 | 12 | mag1500_res_partner_created_at,,in_out,direct,created_at,magentoerpconnect.field_res_partner_created_at,unicode,False,magentoerpconnect.mag1500_res_partner,,,,, | 12 | mag1500_res_partner_created_at,,in_out,direct,created_at,magentoerpconnect.field_res_partner_created_at,unicode,False,magentoerpconnect.mag1500_res_partner,,,,, |
3488 | 13 | mag1500_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 | 13 | mag1500_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 |
3490 | 14 | mag1500_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']) | 14 | mag1500_res_partner_name,,in_out,function,firstname,,unicode,False,magentoerpconnect.mag1500_res_partner,name,"if 'firstname' in resource or 'lastname' in resource: |
3491 | 15 | result = [('name', (resource.get('firstname') or '') + (resource.get('firstname') and ' ' or '') + (resource.get('lastname') or ''))]","add_id = self.browse(cr, uid, resource['id']) | ||
3492 | 15 | fn = add_id.address[0].firstname | 16 | fn = add_id.address[0].firstname |
3493 | 16 | ln = add_id.address[0].lastname | 17 | ln = add_id.address[0].lastname |
3494 | 17 | result=[('firstname', fn), ('lastname', ln)]",, | 18 | result=[('firstname', fn), ('lastname', ln)]",, |
3495 | 18 | 19 | ||
3496 | === modified file 'magentoerpconnect/settings/1.5.0.0/sale.order.line/external.mappinglines.template.csv' | |||
3497 | --- magentoerpconnect/settings/1.5.0.0/sale.order.line/external.mappinglines.template.csv 2012-08-20 21:52:00 +0000 | |||
3498 | +++ magentoerpconnect/settings/1.5.0.0/sale.order.line/external.mappinglines.template.csv 2012-12-03 15:22:20 +0000 | |||
3499 | @@ -9,9 +9,9 @@ | |||
3500 | 9 | clean = re.sub('\w:\w:|\w:\w+;', '', ifield) | 9 | clean = re.sub('\w:\w:|\w:\w+;', '', ifield) |
3501 | 10 | for each in clean.split('{'): | 10 | for each in clean.split('{'): |
3502 | 11 | if each.startswith('""label""'): | 11 | if each.startswith('""label""'): |
3504 | 12 | split_info = each.split(';') | 12 | split_info = each.split(';') |
3505 | 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'])) |
3507 | 14 | 14 | ||
3508 | 15 | result=[('notes', """".join(options_label).replace('""""', '\n').replace('""', ''))] | 15 | result=[('notes', """".join(options_label).replace('""""', '\n').replace('""', ''))] |
3509 | 16 | ",,, | 16 | ",,, |
3510 | 17 | mag1500_sale_order_line_product_id=>,,in,direct,product_id,sale.field_sale_order_line_product_id,int,False,mag1500_sale_order_line,,,,, | 17 | mag1500_sale_order_line_product_id=>,,in,direct,product_id,sale.field_sale_order_line_product_id,int,False,mag1500_sale_order_line,,,,, |
3511 | @@ -21,3 +21,4 @@ | |||
3512 | 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'])), |
3513 | 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)), |
3514 | 23 | ]",,, | 23 | ]",,, |
3515 | 24 | mag1500_sale_order_line_id,,in,direct,item_id,base_sale_multichannels.field_sale_order_line_ext_ref_line,int,False,mag1500_sale_order_line,,,,, | ||
3516 | 24 | 25 | ||
3517 | === modified file 'magentoerpconnect/settings/1.5.0.0/sale.order/external.mappinglines.template.csv' | |||
3518 | --- magentoerpconnect/settings/1.5.0.0/sale.order/external.mappinglines.template.csv 2012-08-14 14:53:28 +0000 | |||
3519 | +++ magentoerpconnect/settings/1.5.0.0/sale.order/external.mappinglines.template.csv 2012-12-03 15:22:20 +0000 | |||
3520 | @@ -16,7 +16,6 @@ | |||
3521 | 16 | mag1500_sale_order_cod_fee=>,,in,function,cod_fee,,float,False,mag1500_sale_order,cod_fee,"#TODO map me | 16 | mag1500_sale_order_cod_fee=>,,in,function,cod_fee,,float,False,mag1500_sale_order,cod_fee,"#TODO map me |
3522 | 17 | ",,, | 17 | ",,, |
3523 | 18 | mag1500_sale_order_gift_certificates_amount=>,,in,function,giftcert_amount,,float,False,mag1500_sale_order,gift_certificates_amount,"result=[('gift_certificates_amount', ifield)]",,, | 18 | mag1500_sale_order_gift_certificates_amount=>,,in,function,giftcert_amount,,float,False,mag1500_sale_order,gift_certificates_amount,"result=[('gift_certificates_amount', ifield)]",,, |
3524 | 19 | mag1500_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)]",,, | ||
3525 | 20 | mag1500_sale_order_gift_certificates_code=>,,in,function,giftcert_code,,unicode,False,mag1500_sale_order,gift_certificates_code,"result = [('gift_certificates_code', ifield)]",,, | 19 | mag1500_sale_order_gift_certificates_code=>,,in,function,giftcert_code,,unicode,False,mag1500_sale_order,gift_certificates_code,"result = [('gift_certificates_code', ifield)]",,, |
3526 | 21 | mag1500_sale_order_carrier_id=>,,in,function,shipping_method,,unicode,False,mag1500_sale_order,carrier_id,"if ifield: | 20 | mag1500_sale_order_carrier_id=>,,in,function,shipping_method,,unicode,False,mag1500_sale_order,carrier_id,"if ifield: |
3527 | 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)]) |
3528 | @@ -28,5 +27,17 @@ | |||
3529 | 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') |
3530 | 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}) |
3531 | 30 | result=[('carrier_id', carrier_id)]",,, | 29 | result=[('carrier_id', carrier_id)]",,, |
3534 | 31 | mag1500_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]",,, | 30 | mag1500_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)) |
3535 | 32 | mag1500_s ale_order_date,,in,direct,created_at,sale.field_sale_order_date_order,datetime,False,mag1500_sale_order,,,,,%Y-%m-%d %H:%M:%S | 31 | amount_tax_exc = float(resource.get('shipping_amount', 0)) |
3536 | 32 | |||
3537 | 33 | if amount_tax_exc: | ||
3538 | 34 | tax_rate = amount_tax_inc/amount_tax_exc -1 | ||
3539 | 35 | else: | ||
3540 | 36 | tax_rate = 0 | ||
3541 | 37 | |||
3542 | 38 | result=[ | ||
3543 | 39 | ('shipping_amount_tax_included', amount_tax_inc), | ||
3544 | 40 | ('shipping_amount_tax_excluded', amount_tax_exc), | ||
3545 | 41 | ('shipping_tax_rate', tax_rate), | ||
3546 | 42 | ]",,, | ||
3547 | 43 | mag1500_sale_order_date,,in,direct,created_at,sale.field_sale_order_date_order,datetime,False,mag1500_sale_order,,,,,%Y-%m-%d %H:%M:%S | ||
3548 | 33 | 44 | ||
3549 | === modified file 'magentoerpconnect/stock.py' | |||
3550 | --- magentoerpconnect/stock.py 2012-05-25 15:37:26 +0000 | |||
3551 | +++ magentoerpconnect/stock.py 2012-12-03 15:22:20 +0000 | |||
3552 | @@ -21,15 +21,14 @@ | |||
3553 | 21 | 21 | ||
3554 | 22 | import xmlrpclib | 22 | import xmlrpclib |
3555 | 23 | 23 | ||
3560 | 24 | from osv import fields,osv | 24 | from openerp.osv.orm import Model |
3561 | 25 | from tools.translate import _ | 25 | from openerp.tools.translate import _ |
3562 | 26 | from openerp.addons.base_sale_multichannels.sale import \ | 26 | from base_sale_multichannels.sale import ExternalShippingCreateError |
3559 | 27 | ExternalShippingCreateError | ||
3563 | 28 | 27 | ||
3564 | 29 | import logging | 28 | import logging |
3565 | 30 | _logger = logging.getLogger(__name__) | 29 | _logger = logging.getLogger(__name__) |
3566 | 31 | 30 | ||
3568 | 32 | class stock_picking(osv.osv): | 31 | class stock_picking(Model): |
3569 | 33 | 32 | ||
3570 | 34 | _inherit = "stock.picking" | 33 | _inherit = "stock.picking" |
3571 | 35 | 34 | ||
3572 | @@ -122,5 +121,3 @@ | |||
3573 | 122 | if res: | 121 | if res: |
3574 | 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) |
3575 | 124 | return True | 123 | return True |
3576 | 125 | |||
3577 | 126 | stock_picking() | ||
3578 | 127 | 124 | ||
3579 | === modified file 'magentoerpconnect/wizard/open_product_by_attribut_set.py' | |||
3580 | --- magentoerpconnect/wizard/open_product_by_attribut_set.py 2011-12-17 20:57:57 +0000 | |||
3581 | +++ magentoerpconnect/wizard/open_product_by_attribut_set.py 2012-12-03 15:22:20 +0000 | |||
3582 | @@ -19,13 +19,13 @@ | |||
3583 | 19 | # # | 19 | # # |
3584 | 20 | ################################################################################# | 20 | ################################################################################# |
3585 | 21 | 21 | ||
3590 | 22 | from osv import fields,osv | 22 | from openerp.osv.orm import TransientModel |
3591 | 23 | 23 | from openerp.osv import fields | |
3592 | 24 | 24 | ||
3593 | 25 | class open_product_by_attribut_set(osv.osv_memory): | 25 | |
3594 | 26 | class open_product_by_attribut_set(TransientModel): | ||
3595 | 26 | _name = 'open.product.by.attribut.set' | 27 | _name = 'open.product.by.attribut.set' |
3596 | 27 | _description = 'Wizard to open product by attributs set' | 28 | _description = 'Wizard to open product by attributs set' |
3597 | 28 | |||
3598 | 29 | _columns = { | 29 | _columns = { |
3599 | 30 | 'attributs_set':fields.many2one('magerp.product_attribute_set', 'Attributs Set'), | 30 | 'attributs_set':fields.many2one('magerp.product_attribute_set', 'Attributs Set'), |
3600 | 31 | } | 31 | } |
3601 | @@ -51,5 +51,3 @@ | |||
3602 | 51 | result['domain'] = "[('set', '=', %s)]" % attribute_set.id | 51 | result['domain'] = "[('set', '=', %s)]" % attribute_set.id |
3603 | 52 | result['name'] = attribute_set.attribute_set_name | 52 | result['name'] = attribute_set.attribute_set_name |
3604 | 53 | return result | 53 | return result |
3605 | 54 | |||
3606 | 55 | open_product_by_attribut_set() | ||
3607 | 56 | 54 | ||
3608 | === modified file 'magentoerpconnect_bundle/__openerp__.py' | |||
3609 | --- magentoerpconnect_bundle/__openerp__.py 2012-03-15 09:47:04 +0000 | |||
3610 | +++ magentoerpconnect_bundle/__openerp__.py 2012-12-03 15:22:20 +0000 | |||
3611 | @@ -22,7 +22,7 @@ | |||
3612 | 22 | 22 | ||
3613 | 23 | { | 23 | { |
3614 | 24 | 'name': 'magentoerpconnect_bundle', | 24 | 'name': 'magentoerpconnect_bundle', |
3616 | 25 | 'version': '0.1', | 25 | 'version': '6.1.0', |
3617 | 26 | 'category': 'Generic Modules', | 26 | 'category': 'Generic Modules', |
3618 | 27 | 'license': 'AGPL-3', | 27 | 'license': 'AGPL-3', |
3619 | 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. |
3620 | @@ -41,9 +41,9 @@ | |||
3621 | 41 | 'images/magentoerpconnect.png', | 41 | 'images/magentoerpconnect.png', |
3622 | 42 | ], | 42 | ], |
3623 | 43 | "website" : "https://launchpad.net/magentoerpconnect", | 43 | "website" : "https://launchpad.net/magentoerpconnect", |
3625 | 44 | 'depends': ['magentoerpconnect','sale_bundle_product'], | 44 | 'depends': ['magentoerpconnect','sale_bundle_product'], |
3626 | 45 | 'init_xml': [], | 45 | 'init_xml': [], |
3628 | 46 | 'update_xml': [ | 46 | 'update_xml': [ |
3629 | 47 | 'sale_bundle_product_view.xml', | 47 | 'sale_bundle_product_view.xml', |
3630 | 48 | 'product_view.xml', | 48 | 'product_view.xml', |
3631 | 49 | 'settings/1.3.2.4/external.mappinglines.template.csv', | 49 | 'settings/1.3.2.4/external.mappinglines.template.csv', |
3632 | 50 | 50 | ||
3633 | === modified file 'magentoerpconnect_bundle/product.py' | |||
3634 | --- magentoerpconnect_bundle/product.py 2012-03-28 09:49:00 +0000 | |||
3635 | +++ magentoerpconnect_bundle/product.py 2012-12-03 15:22:20 +0000 | |||
3636 | @@ -19,13 +19,11 @@ | |||
3637 | 19 | # # | 19 | # # |
3638 | 20 | ################################################################################# | 20 | ################################################################################# |
3639 | 21 | 21 | ||
3645 | 22 | from osv import osv, fields | 22 | from openerp.osv.orm import Model |
3646 | 23 | import netsvc | 23 | |
3647 | 24 | 24 | class product_product(Model): | |
3643 | 25 | |||
3644 | 26 | class product_product(osv.osv): | ||
3648 | 27 | _inherit = "product.product" | 25 | _inherit = "product.product" |
3650 | 28 | 26 | ||
3651 | 29 | def get_bundle_component(self, cr, uid, ids, context): | 27 | def get_bundle_component(self, cr, uid, ids, context): |
3652 | 30 | res = {} | 28 | res = {} |
3653 | 31 | for product in self.browse(cr, uid, ids, context=context): | 29 | for product in self.browse(cr, uid, ids, context=context): |
3654 | @@ -34,7 +32,7 @@ | |||
3655 | 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: |
3656 | 35 | res[product.id].append(product_item_set_line.product_id.id) | 33 | res[product.id].append(product_item_set_line.product_id.id) |
3657 | 36 | return res | 34 | return res |
3659 | 37 | 35 | ||
3660 | 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): |
3661 | 39 | #When the export of a bundle product is forced we should check if all variant are already exported | 37 | #When the export of a bundle product is forced we should check if all variant are already exported |
3662 | 40 | if context.get('force_export', False) and product_type == 'bundle': | 38 | if context.get('force_export', False) and product_type == 'bundle': |
3663 | @@ -44,24 +42,19 @@ | |||
3664 | 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): |
3665 | 45 | self.ext_export(cr, uid, [id], external_referential_ids, defaults, context) | 43 | self.ext_export(cr, uid, [id], external_referential_ids, defaults, context) |
3666 | 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) |
3668 | 47 | 45 | ||
3669 | 48 | 46 | ||
3670 | 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): |
3671 | 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']) |
3672 | 51 | # check if not already created | 49 | # check if not already created |
3673 | 52 | |||
3674 | 53 | |||
3675 | 54 | #TODO add the data | 50 | #TODO add the data |
3678 | 55 | 51 | data.update({'configurable_products_data': products_data, | |
3679 | 56 | data.update({'configurable_products_data': products_data, 'configurable_attributes_data': attributes_data, 'associated_skus':associated_skus}) | 52 | 'configurable_attributes_data': attributes_data, |
3680 | 53 | 'associated_skus':associated_skus}) | ||
3681 | 57 | return data | 54 | return data |
3682 | 58 | 55 | ||
3683 | 59 | |||
3684 | 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): |
3685 | 61 | if data.get('type_id', False) == 'bundle': | 57 | if data.get('type_id', False) == 'bundle': |
3686 | 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) |
3687 | 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) |
3688 | 64 | |||
3689 | 65 | |||
3690 | 66 | product_product() | ||
3691 | 67 | 60 | ||
3692 | 68 | 61 | ||
3693 | === modified file 'magentoerpconnect_bundle/product_view.xml' | |||
3694 | --- magentoerpconnect_bundle/product_view.xml 2011-07-06 19:15:30 +0000 | |||
3695 | +++ magentoerpconnect_bundle/product_view.xml 2012-12-03 15:22:20 +0000 | |||
3696 | @@ -7,37 +7,37 @@ | |||
3697 | 7 | 7 | ||
3698 | 8 | <openerp> | 8 | <openerp> |
3699 | 9 | <data> | 9 | <data> |
3731 | 10 | 10 | ||
3732 | 11 | <!-- INHERITED VIEW FOR THE OBJECT : product_product | 11 | <!-- INHERITED VIEW FOR THE OBJECT : product_product |
3733 | 12 | 12 | ||
3734 | 13 | <record id="product_view_form" model="ir.ui.view"> | 13 | <record id="product_view_form" model="ir.ui.view"> |
3735 | 14 | <field name="name">magentoerpconnect_bundle.product_product.view_form</field> | 14 | <field name="name">magentoerpconnect_bundle.product_product.view_form</field> |
3736 | 15 | <field name="model">product.product</field> | 15 | <field name="model">product.product</field> |
3737 | 16 | <field name="inherit_id" ref="module_name_to_inherit.view_id" /> | 16 | <field name="inherit_id" ref="module_name_to_inherit.view_id" /> |
3738 | 17 | <field eval="16" name="priority"/> | 17 | <field eval="16" name="priority"/> |
3739 | 18 | <field name="type">form</field> | 18 | <field name="type">form</field> |
3740 | 19 | <field name="arch" type="xml"> | 19 | <field name="arch" type="xml"> |
3741 | 20 | <data> | 20 | <data> |
3742 | 21 | <field name="field_reference" position="after"> | 21 | <field name="field_reference" position="after"> |
3743 | 22 | </field> | 22 | </field> |
3744 | 23 | </data> | 23 | </data> |
3745 | 24 | </field> | 24 | </field> |
3746 | 25 | </record> | 25 | </record> |
3747 | 26 | 26 | ||
3748 | 27 | <record id="product_view_tree" model="ir.ui.view"> | 27 | <record id="product_view_tree" model="ir.ui.view"> |
3749 | 28 | <field name="name">magentoerpconnect_bundle.product_product.view_tree</field> | 28 | <field name="name">magentoerpconnect_bundle.product_product.view_tree</field> |
3750 | 29 | <field name="model">product.product</field> | 29 | <field name="model">product.product</field> |
3751 | 30 | <field name="inherit_id" ref="module_name_to_inherit.view_id" /> | 30 | <field name="inherit_id" ref="module_name_to_inherit.view_id" /> |
3752 | 31 | <field eval="16" name="priority"/> | 31 | <field eval="16" name="priority"/> |
3753 | 32 | <field name="type">tree</field> | 32 | <field name="type">tree</field> |
3754 | 33 | <field name="arch" type="xml"> | 33 | <field name="arch" type="xml"> |
3755 | 34 | <data> | 34 | <data> |
3756 | 35 | <field name="field_reference" position="after"> | 35 | <field name="field_reference" position="after"> |
3757 | 36 | </field> | 36 | </field> |
3758 | 37 | </data> | 37 | </data> |
3759 | 38 | </field> | 38 | </field> |
3760 | 39 | </record> | 39 | </record> |
3761 | 40 | 40 | ||
3762 | 41 | --> | 41 | --> |
3763 | 42 | 42 | ||
3764 | 43 | 43 | ||
3765 | 44 | 44 | ||
3766 | === modified file 'magentoerpconnect_bundle/sale.py' | |||
3767 | --- magentoerpconnect_bundle/sale.py 2012-03-15 09:47:04 +0000 | |||
3768 | +++ magentoerpconnect_bundle/sale.py 2012-12-03 15:22:20 +0000 | |||
3769 | @@ -19,10 +19,10 @@ | |||
3770 | 19 | # # | 19 | # # |
3771 | 20 | ################################################################################# | 20 | ################################################################################# |
3772 | 21 | 21 | ||
3777 | 22 | from osv import osv | 22 | from openerp.osv.orm import Model |
3778 | 23 | 23 | ||
3779 | 24 | 24 | ||
3780 | 25 | class sale_order(osv.osv): | 25 | class sale_order(Model): |
3781 | 26 | _inherit = "sale.order" | 26 | _inherit = "sale.order" |
3782 | 27 | 27 | ||
3783 | 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): |
3784 | @@ -37,5 +37,3 @@ | |||
3785 | 37 | else: | 37 | else: |
3786 | 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, |
3787 | 39 | top_item, child_items, context=context) | 39 | top_item, child_items, context=context) |
3788 | 40 | |||
3789 | 41 | sale_order() | ||
3790 | 42 | 40 | ||
3791 | === modified file 'magentoerpconnect_bundle/sale_bundle_product.py' | |||
3792 | --- magentoerpconnect_bundle/sale_bundle_product.py 2011-10-30 20:09:37 +0000 | |||
3793 | +++ magentoerpconnect_bundle/sale_bundle_product.py 2012-12-03 15:22:20 +0000 | |||
3794 | @@ -19,24 +19,14 @@ | |||
3795 | 19 | # # | 19 | # # |
3796 | 20 | ################################################################################# | 20 | ################################################################################# |
3797 | 21 | 21 | ||
3804 | 22 | from osv import osv, fields | 22 | from openerp.osv.orm import Model |
3805 | 23 | import netsvc | 23 | from openerp.osv import fields |
3806 | 24 | 24 | ||
3807 | 25 | 25 | ||
3808 | 26 | class product_item_set_line(osv.osv): | 26 | class product_item_set_line(Model): |
3803 | 27 | |||
3809 | 28 | _inherit = "product.item.set" | 27 | _inherit = "product.item.set" |
3810 | 29 | |||
3811 | 30 | |||
3812 | 31 | _columns = { | 28 | _columns = { |
3813 | 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'), |
3822 | 33 | 30 | } | |
3815 | 34 | } | ||
3816 | 35 | |||
3817 | 36 | _defaults = { | ||
3818 | 37 | |||
3819 | 38 | } | ||
3820 | 39 | |||
3821 | 40 | product_item_set_line() | ||
3823 | 41 | 31 | ||
3824 | 42 | 32 | ||
3825 | 43 | 33 | ||
3826 | === modified file 'magentoerpconnect_bundle/sale_bundle_product_view.xml' | |||
3827 | --- magentoerpconnect_bundle/sale_bundle_product_view.xml 2011-10-30 20:09:37 +0000 | |||
3828 | +++ magentoerpconnect_bundle/sale_bundle_product_view.xml 2012-12-03 15:22:20 +0000 | |||
3829 | @@ -7,23 +7,23 @@ | |||
3830 | 7 | 7 | ||
3831 | 8 | <openerp> | 8 | <openerp> |
3832 | 9 | <data> | 9 | <data> |
3834 | 10 | 10 | ||
3835 | 11 | <!-- INHERITED VIEW FOR THE OBJECT : product_item_set_line --> | 11 | <!-- INHERITED VIEW FOR THE OBJECT : product_item_set_line --> |
3836 | 12 | 12 | ||
3841 | 13 | <record id="product_item_set_view_form" model="ir.ui.view"> | 13 | <record id="product_item_set_view_form" model="ir.ui.view"> |
3842 | 14 | <field name="name">magentoerpconnect_bundle.product_item_set.view_form</field> | 14 | <field name="name">magentoerpconnect_bundle.product_item_set.view_form</field> |
3843 | 15 | <field name="model">product.item.set</field> | 15 | <field name="model">product.item.set</field> |
3844 | 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" /> |
3845 | 17 | <field eval="16" name="priority"/> | 17 | <field eval="16" name="priority"/> |
3855 | 18 | <field name="type">form</field> | 18 | <field name="type">form</field> |
3856 | 19 | <field name="arch" type="xml"> | 19 | <field name="arch" type="xml"> |
3857 | 20 | <data> | 20 | <data> |
3858 | 21 | <field name="required" position="after"> | 21 | <field name="required" position="after"> |
3859 | 22 | <field name="magento_render_type" /> | 22 | <field name="magento_render_type" /> |
3860 | 23 | </field> | 23 | </field> |
3861 | 24 | </data> | 24 | </data> |
3862 | 25 | </field> | 25 | </field> |
3863 | 26 | </record> | 26 | </record> |
3864 | 27 | 27 | ||
3865 | 28 | </data> | 28 | </data> |
3866 | 29 | </openerp> | 29 | </openerp> |
3867 | 30 | 30 | ||
3868 | === modified file 'magentoerpconnect_bundle_split/__openerp__.py' | |||
3869 | --- magentoerpconnect_bundle_split/__openerp__.py 2012-05-18 13:38:51 +0000 | |||
3870 | +++ magentoerpconnect_bundle_split/__openerp__.py 2012-12-03 15:22:20 +0000 | |||
3871 | @@ -21,7 +21,7 @@ | |||
3872 | 21 | 21 | ||
3873 | 22 | { | 22 | { |
3874 | 23 | 'name': 'Magentoerpconnect Bundle Split', | 23 | 'name': 'Magentoerpconnect Bundle Split', |
3876 | 24 | 'version': '1.0', | 24 | 'version': '6.1.0', |
3877 | 25 | 'category': 'Generic Modules', | 25 | 'category': 'Generic Modules', |
3878 | 26 | "author" : "Camptocamp", | 26 | "author" : "Camptocamp", |
3879 | 27 | 'license': 'AGPL-3', | 27 | 'license': 'AGPL-3', |
3880 | 28 | 28 | ||
3881 | === modified file 'magentoerpconnect_bundle_split/sale.py' | |||
3882 | --- magentoerpconnect_bundle_split/sale.py 2012-05-23 17:38:35 +0000 | |||
3883 | +++ magentoerpconnect_bundle_split/sale.py 2012-12-03 15:22:20 +0000 | |||
3884 | @@ -19,10 +19,11 @@ | |||
3885 | 19 | # | 19 | # |
3886 | 20 | ############################################################################## | 20 | ############################################################################## |
3887 | 21 | 21 | ||
3892 | 22 | from osv import osv, fields | 22 | from openerp.osv.orm import Model |
3893 | 23 | 23 | from openerp.osv import fields | |
3894 | 24 | 24 | ||
3895 | 25 | class sale_order(osv.osv): | 25 | |
3896 | 26 | class sale_order(Model): | ||
3897 | 26 | _inherit = "sale.order" | 27 | _inherit = "sale.order" |
3898 | 27 | 28 | ||
3899 | 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): |
3900 | @@ -47,15 +48,15 @@ | |||
3901 | 47 | else: | 48 | else: |
3902 | 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, |
3903 | 49 | top_item, child_items, context=context) | 50 | top_item, child_items, context=context) |
3906 | 50 | def oe_create(self, cr, uid, | 51 | def oe_create(self, cr, uid, |
3907 | 51 | external_session, vals, resource, defaults, context): | 52 | external_session, vals, resource, defaults, context): |
3908 | 52 | 53 | ||
3915 | 53 | order_id = super(sale_order, self).\ | 54 | order_id = super(sale_order, self).\ |
3916 | 54 | oe_create(cr, uid, external_session, | 55 | oe_create(cr, uid, external_session, |
3917 | 55 | vals, | 56 | vals, |
3918 | 56 | resource, | 57 | resource, |
3919 | 57 | defaults=defaults, | 58 | defaults=defaults, |
3920 | 58 | context=context) | 59 | context=context) |
3921 | 59 | 60 | ||
3922 | 60 | order_line_obj = self.pool.get('sale.order.line') | 61 | order_line_obj = self.pool.get('sale.order.line') |
3923 | 61 | order = self.browse(cr, uid, order_id, context=context) | 62 | order = self.browse(cr, uid, order_id, context=context) |
3924 | @@ -86,17 +87,11 @@ | |||
3925 | 86 | res['sale_line_bundle_id'] = line.bundle_parent_id.id | 87 | res['sale_line_bundle_id'] = line.bundle_parent_id.id |
3926 | 87 | return res | 88 | return res |
3927 | 88 | 89 | ||
3933 | 89 | sale_order() | 90 | |
3934 | 90 | 91 | class sale_order_line(Model): | |
3930 | 91 | |||
3931 | 92 | class sale_order_line(osv.osv): | ||
3932 | 93 | |||
3935 | 94 | _inherit = 'sale.order.line' | 92 | _inherit = 'sale.order.line' |
3936 | 95 | |||
3937 | 96 | _columns = { | 93 | _columns = { |
3938 | 97 | 'bundle_parent_id': fields.many2one('sale.order.line', 'Bundle Line'), | 94 | 'bundle_parent_id': fields.many2one('sale.order.line', 'Bundle Line'), |
3939 | 98 | 'magento_item_id': fields.integer('Magento Item ID'), | 95 | 'magento_item_id': fields.integer('Magento Item ID'), |
3940 | 99 | 'magento_parent_item_id': fields.integer('Magento Item ID'), | 96 | 'magento_parent_item_id': fields.integer('Magento Item ID'), |
3944 | 100 | } | 97 | } |
3942 | 101 | |||
3943 | 102 | sale_order_line() | ||
3945 | 103 | 98 | ||
3946 | === modified file 'magentoerpconnect_bundle_split/stock.py' | |||
3947 | --- magentoerpconnect_bundle_split/stock.py 2012-05-23 17:38:35 +0000 | |||
3948 | +++ magentoerpconnect_bundle_split/stock.py 2012-12-03 15:22:20 +0000 | |||
3949 | @@ -19,11 +19,11 @@ | |||
3950 | 19 | # | 19 | # |
3951 | 20 | ############################################################################## | 20 | ############################################################################## |
3952 | 21 | 21 | ||
3958 | 22 | from osv import osv, fields | 22 | from openerp.osv.orm import Model |
3959 | 23 | 23 | from openerp.osv import fields | |
3960 | 24 | 24 | ||
3961 | 25 | class stock_picking(osv.osv): | 25 | |
3962 | 26 | 26 | class stock_picking(Model): | |
3963 | 27 | _inherit = 'stock.picking' | 27 | _inherit = 'stock.picking' |
3964 | 28 | 28 | ||
3965 | 29 | def create_ext_shipping(self, cr, uid, id, picking_type, | 29 | def create_ext_shipping(self, cr, uid, id, picking_type, |
3966 | @@ -56,16 +56,10 @@ | |||
3967 | 56 | cr, uid, id, picking_type, | 56 | cr, uid, id, picking_type, |
3968 | 57 | external_referential_id, context) | 57 | external_referential_id, context) |
3969 | 58 | 58 | ||
3975 | 59 | stock_picking() | 59 | |
3976 | 60 | 60 | class stock_move(Model): | |
3972 | 61 | |||
3973 | 62 | class stock_move(osv.osv): | ||
3974 | 63 | |||
3977 | 64 | _inherit = 'stock.move' | 61 | _inherit = 'stock.move' |
3978 | 65 | |||
3979 | 66 | _columns = { | 62 | _columns = { |
3980 | 67 | 'sale_line_bundle_id': fields.many2one('sale.order.line', | 63 | 'sale_line_bundle_id': fields.many2one('sale.order.line', |
3981 | 68 | string='Sale Order Line Bundle') | 64 | string='Sale Order Line Bundle') |
3985 | 69 | } | 65 | } |
3983 | 70 | |||
3984 | 71 | stock_move() | ||
3986 | 72 | 66 | ||
3987 | === renamed directory 'magentoerpconnect_partner_fiscal_category' => 'magentoerpconnect_customer_fiscal_category' | |||
3988 | === modified file 'magentoerpconnect_customer_fiscal_category/__openerp__.py' | |||
3989 | --- magentoerpconnect_partner_fiscal_category/__openerp__.py 2012-03-27 09:51:08 +0000 | |||
3990 | +++ magentoerpconnect_customer_fiscal_category/__openerp__.py 2012-12-03 15:22:20 +0000 | |||
3991 | @@ -21,7 +21,7 @@ | |||
3992 | 21 | 21 | ||
3993 | 22 | { | 22 | { |
3994 | 23 | 'name': 'Magentoerpconnect Partner Fiscal Category', | 23 | 'name': 'Magentoerpconnect Partner Fiscal Category', |
3996 | 24 | 'version': '1.0', | 24 | 'version': '6.1.0', |
3997 | 25 | 'category': 'Generic Modules', | 25 | 'category': 'Generic Modules', |
3998 | 26 | "author" : "Camptocamp", | 26 | "author" : "Camptocamp", |
3999 | 27 | 'license': 'AGPL-3', | 27 | 'license': 'AGPL-3', |
4000 | @@ -46,7 +46,7 @@ | |||
4001 | 46 | 'depends': ['magentoerpconnect', | 46 | 'depends': ['magentoerpconnect', |
4002 | 47 | 'account_fiscal_rules_partner_category', ], | 47 | 'account_fiscal_rules_partner_category', ], |
4003 | 48 | 'init_xml': [], | 48 | 'init_xml': [], |
4005 | 49 | 'update_xml': ['settings/1.3.2.4/external.mappinglines.template.csv', | 49 | 'update_xml': [#'settings/1.3.2.4/external.mappinglines.template.csv', |
4006 | 50 | 'settings/1.5.0.0/external.mappinglines.template.csv', ], | 50 | 'settings/1.5.0.0/external.mappinglines.template.csv', ], |
4007 | 51 | 'demo_xml': [], | 51 | 'demo_xml': [], |
4008 | 52 | 'installable': True, | 52 | 'installable': True, |
4009 | 53 | 53 | ||
4010 | === modified file 'magentoerpconnect_customer_fiscal_category/settings/1.5.0.0/external.mappinglines.template.csv' | |||
4011 | --- magentoerpconnect_partner_fiscal_category/settings/1.5.0.0/external.mappinglines.template.csv 2012-05-09 12:54:07 +0000 | |||
4012 | +++ magentoerpconnect_customer_fiscal_category/settings/1.5.0.0/external.mappinglines.template.csv 2012-12-03 15:22:20 +0000 | |||
4013 | @@ -1,7 +1,2 @@ | |||
4021 | 1 | id,type_id:id,model_id:id,external_field,field_id:id,type,evaluation_type,external_type,child_mapping_id:id,in_function,out_function | 1 | id,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 |
4022 | 2 | magento_1500_prt_tax_class_id,magentoerpconnect.magento1500,base.model_res_partner,tax_class_id,,in_out,function,int,,"result = [('fiscal_category_id', False)] | 2 | mag1500_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,,,,, |
4016 | 3 | if ifield: | ||
4017 | 4 | category_obj = self.pool.get('res.partner.category') | ||
4018 | 5 | category_ids = category_obj.search(cr, uid, [('tax_class_id', '=', ifield)]) | ||
4019 | 6 | if category_ids: | ||
4020 | 7 | result = [('fiscal_category_id', category_ids[0])]", | ||
4023 | 8 | 3 | ||
4024 | === modified file 'magentoerpconnect_init_stock/__openerp__.py' | |||
4025 | --- magentoerpconnect_init_stock/__openerp__.py 2012-03-21 11:09:29 +0000 | |||
4026 | +++ magentoerpconnect_init_stock/__openerp__.py 2012-12-03 15:22:20 +0000 | |||
4027 | @@ -20,7 +20,7 @@ | |||
4028 | 20 | ############################################################################## | 20 | ############################################################################## |
4029 | 21 | 21 | ||
4030 | 22 | {'name' : 'Magentoerpconnect Initialize Stock', | 22 | {'name' : 'Magentoerpconnect Initialize Stock', |
4032 | 23 | 'version' : '1.0', | 23 | 'version' : '6.1.0', |
4033 | 24 | 'author' : 'Camptocamp', | 24 | 'author' : 'Camptocamp', |
4034 | 25 | 'maintainer': 'Camptocamp', | 25 | 'maintainer': 'Camptocamp', |
4035 | 26 | 'license': 'AGPL-3', | 26 | 'license': 'AGPL-3', |
4036 | 27 | 27 | ||
4037 | === modified file 'magentoerpconnect_init_stock/product.py' | |||
4038 | --- magentoerpconnect_init_stock/product.py 2012-03-21 11:09:29 +0000 | |||
4039 | +++ magentoerpconnect_init_stock/product.py 2012-12-03 15:22:20 +0000 | |||
4040 | @@ -20,12 +20,11 @@ | |||
4041 | 20 | ############################################################################## | 20 | ############################################################################## |
4042 | 21 | 21 | ||
4043 | 22 | import logging | 22 | import logging |
4045 | 23 | from osv import osv | 23 | from openerp.osv.orm import Model |
4046 | 24 | 24 | ||
4047 | 25 | _logger = logging.getLogger(__name__) | 25 | _logger = logging.getLogger(__name__) |
4048 | 26 | 26 | ||
4051 | 27 | 27 | class product_product(Model): | |
4050 | 28 | class product_product(osv.osv): | ||
4052 | 29 | 28 | ||
4053 | 30 | _inherit = 'product.product' | 29 | _inherit = 'product.product' |
4054 | 31 | 30 | ||
4055 | @@ -52,5 +51,3 @@ | |||
4056 | 52 | self._magento_init_stock(cr, uid, oe_id, magento_product_id, | 51 | self._magento_init_stock(cr, uid, oe_id, magento_product_id, |
4057 | 53 | conn, context=context) | 52 | conn, context=context) |
4058 | 54 | return magento_product_id | 53 | return magento_product_id |
4059 | 55 | |||
4060 | 56 | product_product() | ||
4061 | 57 | 54 | ||
4062 | === added directory 'magentoerpconnect_magento_invoice' | |||
4063 | === added file 'magentoerpconnect_magento_invoice/__init__.py' | |||
4064 | --- magentoerpconnect_magento_invoice/__init__.py 1970-01-01 00:00:00 +0000 | |||
4065 | +++ magentoerpconnect_magento_invoice/__init__.py 2012-12-03 15:22:20 +0000 | |||
4066 | @@ -0,0 +1,28 @@ | |||
4067 | 1 | # -*- encoding: utf-8 -*- | ||
4068 | 2 | ############################################################################### | ||
4069 | 3 | # | ||
4070 | 4 | # magentoerpconnect_magento_invoice for OpenERP | ||
4071 | 5 | # Copyright (C) 2012-TODAY Akretion <http://www.akretion.com>. All Rights Reserved | ||
4072 | 6 | # @author Sébastien BEAU <sebastien.beau@akretion.com> | ||
4073 | 7 | # This program is free software: you can redistribute it and/or modify | ||
4074 | 8 | # it under the terms of the GNU Affero General Public License as | ||
4075 | 9 | # published by the Free Software Foundation, either version 3 of the | ||
4076 | 10 | # License, or (at your option) any later version. | ||
4077 | 11 | # | ||
4078 | 12 | # This program is distributed in the hope that it will be useful, | ||
4079 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
4080 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
4081 | 15 | # GNU Affero General Public License for more details. | ||
4082 | 16 | # | ||
4083 | 17 | # You should have received a copy of the GNU Affero General Public License | ||
4084 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
4085 | 19 | # | ||
4086 | 20 | ############################################################################### | ||
4087 | 21 | |||
4088 | 22 | |||
4089 | 23 | |||
4090 | 24 | import account | ||
4091 | 25 | |||
4092 | 26 | |||
4093 | 27 | |||
4094 | 28 | |||
4095 | 0 | 29 | ||
4096 | === added file 'magentoerpconnect_magento_invoice/__openerp__.py' | |||
4097 | --- magentoerpconnect_magento_invoice/__openerp__.py 1970-01-01 00:00:00 +0000 | |||
4098 | +++ magentoerpconnect_magento_invoice/__openerp__.py 2012-12-03 15:22:20 +0000 | |||
4099 | @@ -0,0 +1,44 @@ | |||
4100 | 1 | # -*- encoding: utf-8 -*- | ||
4101 | 2 | ############################################################################### | ||
4102 | 3 | # | ||
4103 | 4 | # magentoerpconnect_magento_invoice for OpenERP | ||
4104 | 5 | # Copyright (C) 2012-TODAY Akretion <http://www.akretion.com>. All Rights Reserved | ||
4105 | 6 | # @author Sébastien BEAU <sebastien.beau@akretion.com> | ||
4106 | 7 | # This program is free software: you can redistribute it and/or modify | ||
4107 | 8 | # it under the terms of the GNU Affero General Public License as | ||
4108 | 9 | # published by the Free Software Foundation, either version 3 of the | ||
4109 | 10 | # License, or (at your option) any later version. | ||
4110 | 11 | # | ||
4111 | 12 | # This program is distributed in the hope that it will be useful, | ||
4112 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
4113 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
4114 | 15 | # GNU Affero General Public License for more details. | ||
4115 | 16 | # | ||
4116 | 17 | # You should have received a copy of the GNU Affero General Public License | ||
4117 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
4118 | 19 | # | ||
4119 | 20 | ############################################################################### | ||
4120 | 21 | |||
4121 | 22 | |||
4122 | 23 | |||
4123 | 24 | |||
4124 | 25 | { | ||
4125 | 26 | 'name': 'magentoerpconnect_magento_invoice', | ||
4126 | 27 | 'version': '6.1.1', | ||
4127 | 28 | 'category': 'Generic Modules', | ||
4128 | 29 | 'license': 'AGPL-3', | ||
4129 | 30 | 'description': """This module will use the Magento invoice number for the OpenERP Invoice. | ||
4130 | 31 | Be carefull if your Magento is not available you can not validade an invoice in OpenERP | ||
4131 | 32 | TODO refactor MagentoERPconnect in order to extract the other way to synchronise order | ||
4132 | 33 | """, | ||
4133 | 34 | 'author': 'Akretion', | ||
4134 | 35 | 'website': 'http://www.akretion.com/', | ||
4135 | 36 | 'depends': ['magentoerpconnect'], | ||
4136 | 37 | 'init_xml': [], | ||
4137 | 38 | 'update_xml': [ | ||
4138 | 39 | ], | ||
4139 | 40 | 'demo_xml': [], | ||
4140 | 41 | 'installable': True, | ||
4141 | 42 | 'active': False, | ||
4142 | 43 | } | ||
4143 | 44 | |||
4144 | 0 | 45 | ||
4145 | === added file 'magentoerpconnect_magento_invoice/account.py' | |||
4146 | --- magentoerpconnect_magento_invoice/account.py 1970-01-01 00:00:00 +0000 | |||
4147 | +++ magentoerpconnect_magento_invoice/account.py 2012-12-03 15:22:20 +0000 | |||
4148 | @@ -0,0 +1,35 @@ | |||
4149 | 1 | # -*- encoding: utf-8 -*- | ||
4150 | 2 | ############################################################################### | ||
4151 | 3 | # | ||
4152 | 4 | # magentoerpconnect_magento_invoice for OpenERP | ||
4153 | 5 | # Copyright (C) 2012-TODAY Akretion <http://www.akretion.com>. All Rights Reserved | ||
4154 | 6 | # @author Sébastien BEAU <sebastien.beau@akretion.com> | ||
4155 | 7 | # This program is free software: you can redistribute it and/or modify | ||
4156 | 8 | # it under the terms of the GNU Affero General Public License as | ||
4157 | 9 | # published by the Free Software Foundation, either version 3 of the | ||
4158 | 10 | # License, or (at your option) any later version. | ||
4159 | 11 | # | ||
4160 | 12 | # This program is distributed in the hope that it will be useful, | ||
4161 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
4162 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
4163 | 15 | # GNU Affero General Public License for more details. | ||
4164 | 16 | # | ||
4165 | 17 | # You should have received a copy of the GNU Affero General Public License | ||
4166 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
4167 | 19 | # | ||
4168 | 20 | ############################################################################### | ||
4169 | 21 | |||
4170 | 22 | |||
4171 | 23 | from openerp.osv.orm import Model | ||
4172 | 24 | |||
4173 | 25 | class account_invoice(Model): | ||
4174 | 26 | _inherit = "account.invoice" | ||
4175 | 27 | |||
4176 | 28 | def action_move_create(self, cr, uid, ids, context=None): | ||
4177 | 29 | if context is None: | ||
4178 | 30 | context = {'lang': 'en_US'} | ||
4179 | 31 | for invoice in self.browse(cr, uid, ids, context=context): | ||
4180 | 32 | ext_invoice_id = self._export_one_invoice(cr, uid, invoice, context=context) | ||
4181 | 33 | invoice.write({'internal_number': ext_invoice_id}, context=context) | ||
4182 | 34 | return super(account_invoice, self).action_move_create(cr, uid, ids, context=context) | ||
4183 | 35 | |||
4184 | 0 | 36 | ||
4185 | === renamed directory 'magentoerpconnect_report_synchronizer' => 'magentoerpconnect_openerp_invoice' | |||
4186 | === modified file 'magentoerpconnect_openerp_invoice/__init__.py' | |||
4187 | --- magentoerpconnect_report_synchronizer/__init__.py 2012-06-01 17:48:36 +0000 | |||
4188 | +++ magentoerpconnect_openerp_invoice/__init__.py 2012-12-03 15:22:20 +0000 | |||
4189 | @@ -20,9 +20,5 @@ | |||
4190 | 20 | ############################################################################### | 20 | ############################################################################### |
4191 | 21 | 21 | ||
4192 | 22 | 22 | ||
4193 | 23 | |||
4194 | 24 | import invoice |
Hi,
Some minor things:
Line 200: order`` is public (accessible from XMR/RPC) but may return a None value if they are zero or many invoices.
The method ``map_magento_
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