Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
159 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
from . import gs1_barcode | ||
from . import gs1_barcode_model_map | ||
from . import res_users |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Copyright 2019 Eficent Business and IT Consulting Services, S.L. | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
from odoo import api, fields, models | ||
|
||
|
||
class GS1BarcodeModelMap(models.Model): | ||
_name = 'gs1_barcode.model.map' | ||
|
||
@api.model | ||
def _get_tier_validation_model_names(self): | ||
res = [] | ||
return res | ||
|
||
model_id = fields.Many2one( | ||
comodel_name="ir.model", | ||
string="Referenced Model", | ||
required=True, | ||
) | ||
model = fields.Char( | ||
related='model_id.model', index=True, store=True, | ||
) | ||
field_id = fields.Many2one( | ||
'ir.model.fields', | ||
required=True, | ||
domain="[('model_id', '=', model_id)]", | ||
) | ||
gs1_barcode_id = fields.Many2one( | ||
'gs1_barcode', | ||
required=True, | ||
) | ||
ai = fields.Char( | ||
related='gs1_barcode_id.ai', | ||
) | ||
|
||
_sql_constraints = [ | ||
('gs1_model_field_uniq', 'unique (model_id,field_id,gs1_barcode_id)', | ||
"There cannot be two repeated mappings of " | ||
"the GS1 code to model and field.")] | ||
|
||
@api.onchange('model_id') | ||
def onchange_model_id(self): | ||
return {'domain': { | ||
'model_id': [ | ||
('model', 'in', self._get_tier_validation_model_names())]}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | ||
"access_gs1_barcode","gs1_barcode","model_gs1_barcode","base.group_user",1,0,0,0 | ||
"access_gs1_barcode_admin","gs1_barcode","model_gs1_barcode","base.group_system",1,1,1,1 | ||
"access_gs1_barcode","access_gs1_barcode","model_gs1_barcode","base.group_user",1,0,0,0 | ||
"access_gs1_barcode_admin","access_gs1_barcode admin","model_gs1_barcode","base.group_system",1,1,1,1 | ||
"access_gs1_barcode_model_map","access_gs1_barcode_model_map","model_gs1_barcode_model_map","base.group_user",1,0,0,0 | ||
"access_gs1_barcode_model_map_admin","access_gs1_barcode_model_map admin","model_gs1_barcode_model_map","base.group_user",1,1,1,1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
|
||
<record id="gs1_barcode_model_map_tree_view" model="ir.ui.view"> | ||
<field name="name">gs1_barcode.model.map.tree</field> | ||
<field name="model">gs1_barcode.model.map</field> | ||
<field name="arch" type="xml"> | ||
<tree string="GS1-128/GS1-Datamatrix decoding model map"> | ||
<field name="gs1_barcode_id" /> | ||
<field name="model_id"/> | ||
<field name="field_id"/> | ||
</tree> | ||
</field> | ||
</record> | ||
|
||
<record id="gs1_barcode_model_map_form_view" model="ir.ui.view"> | ||
<field name="name">gs1_barcode.model.map.form</field> | ||
<field name="model">gs1_barcode.model.map</field> | ||
<field name="arch" type="xml"> | ||
<form string="GS1-128/GS1-Datamatrix decoding model map"> | ||
<sheet> | ||
<group name="application_identifier" string="Application Identifier"> | ||
<field name="ai"/> | ||
<field name="gs1_barcode_id" colspan="4"/> | ||
</group> | ||
<group name="model_mapping" string="Field"> | ||
<field name="model_id"/> | ||
<newline/> | ||
<field name="field_id"/> | ||
</group> | ||
</sheet> | ||
</form> | ||
</field> | ||
</record> | ||
|
||
<!-- Add a menu entry for the configuration of GSA-128 mapping --> | ||
<record id="action_config_gs1_barcode_model_map" model="ir.actions.act_window"> | ||
<field name="name">GS1-128/GS1-Datamatrix Model Mapping</field> | ||
<field name="type">ir.actions.act_window</field> | ||
<field name="res_model">gs1_barcode.model.map</field> | ||
<field name="view_type">form</field> | ||
<field name="view_mode">tree,form</field> | ||
</record> | ||
|
||
<menuitem action="action_config_gs1_barcode_model_map" id="menu_config_gs1_barcode_model_map" parent="base.next_id_9"/> | ||
|
||
</odoo> |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?xml version="1.0" ?> | ||
<!-- | ||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
--> | ||
<odoo noupdate="1"> | ||
<record id="GTIN" model="gs1_barcode.model.map"> | ||
<field name="model_id" ref="stock_barcodes.model_wiz_stock_barcodes_read"/> | ||
<field name="field_id" ref="stock_barcodes.field_wiz_stock_barcodes_read_packaging_id"/> | ||
<field name="gs1_barcode_id" ref="base_gs1_barcode.GTIN"/> | ||
</record> | ||
<record id="CONTENT_GTIN" model="gs1_barcode.model.map"> | ||
<field name="model_id" ref="stock_barcodes.model_wiz_stock_barcodes_read"/> | ||
<field name="field_id" ref="stock_barcodes.field_wiz_stock_barcodes_read_product_id"/> | ||
<field name="gs1_barcode_id" ref="base_gs1_barcode.CONTENT_GTIN"/> | ||
</record> | ||
<record id="LOT" model="gs1_barcode.model.map"> | ||
<field name="model_id" ref="stock_barcodes.model_wiz_stock_barcodes_read"/> | ||
<field name="field_id" ref="stock_barcodes.field_wiz_stock_barcodes_read_lot_id"/> | ||
<field name="gs1_barcode_id" ref="base_gs1_barcode.LOT"/> | ||
</record> | ||
<record id="NB_CONTAINED" model="gs1_barcode.model.map"> | ||
<field name="model_id" ref="stock_barcodes.model_wiz_stock_barcodes_read"/> | ||
<field name="field_id" ref="stock_barcodes.field_wiz_stock_barcodes_read_product_qty"/> | ||
<field name="gs1_barcode_id" ref="base_gs1_barcode.NB_CONTAINED"/> | ||
</record> | ||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
To change the defailt mapping of the Application Identifiers to the | ||
associated fields in the scanning wizard, go to | ||
*Settings -> Technical -> Database Structure -> | ||
GS1-128/GS1-Datamatrix Model Mapping* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters