Add module product_variant_csv_import
This commit is contained in:
23
product_variant_csv_import/__init__.py
Normal file
23
product_variant_csv_import/__init__.py
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Product Variant CSV Import module for Odoo
|
||||||
|
# Copyright (C) 2014 Akretion (http://www.akretion.com)
|
||||||
|
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as
|
||||||
|
# published by the Free Software Foundation, either version 3 of the
|
||||||
|
# License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
from . import product
|
||||||
40
product_variant_csv_import/__openerp__.py
Normal file
40
product_variant_csv_import/__openerp__.py
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Product Variant CSV Import module for Odoo
|
||||||
|
# Copyright (C) 2014 Akretion (http://www.akretion.com)
|
||||||
|
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as
|
||||||
|
# published by the Free Software Foundation, either version 3 of the
|
||||||
|
# License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
'name': 'Product Variant CSV Import',
|
||||||
|
'version': '0.1',
|
||||||
|
'category': 'Barroux',
|
||||||
|
'license': 'AGPL-3',
|
||||||
|
'summary': 'Add menu entry to allow CSV import of templates with variants',
|
||||||
|
'description': """
|
||||||
|
This module adds a menu entry in *Sales > Configuration > Product Categories and attributes > Product Template CSV Import", that will work with the import of CSV file product.template.csv that contains variants.
|
||||||
|
|
||||||
|
This module has been written by Alexis de Lattre from Akretion
|
||||||
|
<alexis.delattre@akretion.com>.
|
||||||
|
""",
|
||||||
|
'author': 'Akretion',
|
||||||
|
'website': 'http://www.akretion.com',
|
||||||
|
'depends': ['product'],
|
||||||
|
'data': ['product_view.xml'],
|
||||||
|
}
|
||||||
31
product_variant_csv_import/product.py
Normal file
31
product_variant_csv_import/product.py
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Product Variant CSV Import module for Odoo
|
||||||
|
# Copyright (C) 2014 Akretion (http://www.akretion.com)
|
||||||
|
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as
|
||||||
|
# published by the Free Software Foundation, either version 3 of the
|
||||||
|
# License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
from openerp import models, fields
|
||||||
|
|
||||||
|
|
||||||
|
class ProductProduct(models.Model):
|
||||||
|
_inherit = 'product.product'
|
||||||
|
|
||||||
|
attribute_value_ids = fields.Many2many(readonly=False)
|
||||||
|
# In the "product" module, attribute_value_ids is Readonly=True
|
||||||
|
# but this blocks the import of products template with variants via CSV
|
||||||
24
product_variant_csv_import/product_view.xml
Normal file
24
product_variant_csv_import/product_view.xml
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright (C) 2014 Akretion
|
||||||
|
The licence is in the file __openerp__.py
|
||||||
|
-->
|
||||||
|
|
||||||
|
<openerp>
|
||||||
|
<data>
|
||||||
|
|
||||||
|
|
||||||
|
<record id="product_template_special_context_action" model="ir.actions.act_window">
|
||||||
|
<field name="name">Product Template CSV Import</field>
|
||||||
|
<field name="res_model">product.template</field>
|
||||||
|
<field name="view_mode">tree,form</field>
|
||||||
|
<field name="context">{"create_product_variant": True}</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
<menuitem id="product_template_special_context_menu"
|
||||||
|
action="product_template_special_context_action" parent="product.prod_config_main"
|
||||||
|
groups="base.group_no_one" sequence="100"/>
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</openerp>
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
id,name
|
||||||
|
test.attribute_pointure,Pointure
|
||||||
|
test.attribute_cuir,Cuir
|
||||||
|
@@ -0,0 +1,8 @@
|
|||||||
|
id,attribute_id/id,name
|
||||||
|
test.pointure_33,test.attribute_pointure,Pointure 33
|
||||||
|
test.pointure_34,test.attribute_pointure,Pointure 34
|
||||||
|
test.pointure_35,test.attribute_pointure,Pointure 35
|
||||||
|
test.pointure_36,test.attribute_pointure,Pointure 36
|
||||||
|
test.pointure_37,test.attribute_pointure,Pointure 37
|
||||||
|
test.cuir_noir,test.attribute_cuir,Cuir noir
|
||||||
|
test.cuir_marron,test.attribute_cuir,Cuir marron
|
||||||
|
13
product_variant_csv_import/sample_csv/product.template.csv
Normal file
13
product_variant_csv_import/sample_csv/product.template.csv
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
id,name,type,weight,weight_net,product_variant_ids/default_code,product_variant_ids/ean13,product_variant_ids/attribute_value_ids/id
|
||||||
|
test.sandale1,Sandale 1,product,0.723,0.723,SANDAL-1-N-33,3518378100019,"test.pointure_33,test.cuir_noir"
|
||||||
|
,,,,,SANDAL-1-M-33,3518378100033,"test.pointure_33,test.cuir_marron"
|
||||||
|
,,,,,SANDAL-1-N-34,3518378100057,"test.pointure_34,test.cuir_noir"
|
||||||
|
,,,,,SANDAL-1-M-34,3518378100071,"test.pointure_34,test.cuir_marron"
|
||||||
|
,,,,,SANDAL-1-N-35,3518378100095,"test.pointure_35,test.cuir_noir"
|
||||||
|
,,,,,SANDAL-1-M-35,3518378100118,"test.pointure_35,test.cuir_marron"
|
||||||
|
test.sandale2,Sandale 2,product,0.760,0.760,SANDAL-2-N-33,3518378100132,"test.pointure_33,test.cuir_noir"
|
||||||
|
,,,,,SANDAL-2-M-33,3518378100156,"test.pointure_33,test.cuir_marron"
|
||||||
|
,,,,,SANDAL-2-N-34,3518378100699,"test.pointure_34,test.cuir_noir"
|
||||||
|
,,,,,SANDAL-2-M-34,3518378100705,"test.pointure_34,test.cuir_marron"
|
||||||
|
,,,,,SANDAL-2-N-35,3518378100712,"test.pointure_35,test.cuir_noir"
|
||||||
|
,,,,,SANDAL-2-M-35,3518378100767,"test.pointure_35,test.cuir_marron"
|
||||||
|
Reference in New Issue
Block a user