Merge lp:~jfb-tempo-consulting/unifield-server/US-8336 into lp:unifield-server

Proposed by jftempo
Status: Merged
Merged at revision: 6083
Proposed branch: lp:~jfb-tempo-consulting/unifield-server/US-8336
Merge into: lp:unifield-server
Diff against target: 438 lines (+208/-39)
7 files modified
bin/addons/mission_stock/mission_stock.py (+82/-29)
bin/addons/mission_stock/mission_stock_view.xml (+40/-0)
bin/addons/msf_profile/data/patches.xml (+3/-0)
bin/addons/msf_profile/msf_profile.py (+71/-1)
bin/addons/msf_sync_data_server/data/sync_server.sync_rule.csv (+2/-2)
bin/addons/product_attributes/product_attributes.py (+7/-5)
bin/addons/product_attributes/wizard/product_merged.py (+3/-2)
To merge this branch: bzr merge lp:~jfb-tempo-consulting/unifield-server/US-8336
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+409202@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bin/addons/mission_stock/mission_stock.py'
--- bin/addons/mission_stock/mission_stock.py 2021-02-09 17:29:10 +0000
+++ bin/addons/mission_stock/mission_stock.py 2021-09-27 10:27:25 +0000
@@ -1019,6 +1019,7 @@
1019 qty = self.pool.get('product.uom')._compute_qty(cr, uid, uom, qty, line.product_id.uom_id.id)1019 qty = self.pool.get('product.uom')._compute_qty(cr, uid, uom, qty, line.product_id.uom_id.id)
10201020
1021 vals['in_pipe_qty'] += qty1021 vals['in_pipe_qty'] += qty
1022 vals['used_in_transaction'] = True
10221023
1023 if partner == coordo_id:1024 if partner == coordo_id:
1024 vals['in_pipe_coor_qty'] += qty1025 vals['in_pipe_coor_qty'] += qty
@@ -1047,6 +1048,53 @@
1047 ''')1048 ''')
1048 res = cr.fetchall()1049 res = cr.fetchall()
1049 all_move_ids = []1050 all_move_ids = []
1051 doc_field_error_dom = [
1052 ('stock_move', 'product_id'),
1053 ('stock_production_lot', 'product_id'),
1054 ('purchase_order_line', 'product_id'),
1055 ('sale_order_line', 'product_id'),
1056 ('tender_line', 'product_id'),
1057 ('physical_inventory_counting', 'product_id'),
1058 ('initial_stock_inventory_line', 'product_id'),
1059 ('real_average_consumption_line', 'product_id'),
1060 ('replenishment_segment_line', 'product_id'),
1061 ('product_list_line', 'name'),
1062 ('composition_kit', 'composition_product_id'),
1063 ('composition_item', 'item_product_id'),
1064 ]
1065
1066 timer_used = time.time()
1067 # record the current value in transaction_updated
1068 cr.execute("update stock_mission_report_line set transaction_updated=coalesce(used_in_transaction, 'f'), used_in_transaction='f' where mission_report_id=%s", (report_id, ))
1069 for table, foreign_field in doc_field_error_dom:
1070 # set used_in_transaction='t'
1071 cr.execute('''
1072 update
1073 stock_mission_report_line l
1074 set
1075 used_in_transaction='t'
1076 from
1077 ''' + table + ''' ft
1078 where
1079 coalesce(l.used_in_transaction,'f')='f' and
1080 l.mission_report_id = %s and
1081 ft.''' + foreign_field + ''' = l.product_id
1082 ''', (report_id, )) # not_a_user_entry
1083
1084 # trigger sync update
1085 cr.execute('''
1086 update ir_model_data d
1087 set last_modification=NOW(), touched='[''used_in_transaction'']'
1088 from
1089 stock_mission_report_line l
1090 where
1091 l.id = d.res_id and
1092 l.transaction_updated!=used_in_transaction and
1093 d.model='stock.mission.report.line' and
1094 l.mission_report_id = %s
1095 ''', (report_id, ))
1096 logging.getLogger('MSR').info("""___ computation of used in transaction in %.2f sec.""" % (time.time() - timer_used))
1097
1050 for move in res:1098 for move in res:
1051 all_move_ids.append(move[0])1099 all_move_ids.append(move[0])
1052 product = product_obj.browse(cr, uid, move[1],1100 product = product_obj.browse(cr, uid, move[1],
@@ -1056,17 +1104,19 @@
1056 if line_id:1104 if line_id:
1057 line = line_obj.browse(cr, uid, line_id[0])1105 line = line_obj.browse(cr, uid, line_id[0])
1058 qty = self.pool.get('product.uom')._compute_qty(cr, uid, move[2], move[3], product.uom_id.id)1106 qty = self.pool.get('product.uom')._compute_qty(cr, uid, move[2], move[3], product.uom_id.id)
1059 vals = {'internal_qty': line.internal_qty or 0.00,1107 vals = {
1060 'stock_qty': line.stock_qty or 0.00,1108 'internal_qty': line.internal_qty or 0.00,
1061 'cross_qty': line.cross_qty or 0.00,1109 'stock_qty': line.stock_qty or 0.00,
1062 'secondary_qty': line.secondary_qty or 0.00,1110 'cross_qty': line.cross_qty or 0.00,
1063 'cu_qty': line.cu_qty or 0.00,1111 'secondary_qty': line.secondary_qty or 0.00,
1064 'quarantine_qty': line.quarantine_qty or 0.00,1112 'cu_qty': line.cu_qty or 0.00,
1065 'input_qty': line.input_qty or 0.00,1113 'quarantine_qty': line.quarantine_qty or 0.00,
1066 'opdd_qty': line.opdd_qty or 0.00,1114 'input_qty': line.input_qty or 0.00,
1067 'updated': True,1115 'opdd_qty': line.opdd_qty or 0.00,
1068 'product_state': line.product_id.state and line.product_id.state.code,}1116 'updated': True,
10691117 'product_state': line.product_id.state and line.product_id.state.code,
1118 'used_in_transaction': True
1119 }
1070 if move[4] in internal_loc:1120 if move[4] in internal_loc:
1071 vals['internal_qty'] -= qty1121 vals['internal_qty'] -= qty
1072 if move[4] in stock_loc:1122 if move[4] in stock_loc:
@@ -1500,8 +1550,8 @@
1500 'product_id': fields.many2one('product.product', string='Name', required=True, ondelete="cascade", select=1),1550 'product_id': fields.many2one('product.product', string='Name', required=True, ondelete="cascade", select=1),
1501 'default_code': fields.related('product_id', 'default_code', string='Reference', type='char', size=64, store=True, write_relate=False),1551 'default_code': fields.related('product_id', 'default_code', string='Reference', type='char', size=64, store=True, write_relate=False),
1502 'xmlid_code': fields.related('product_id', 'xmlid_code', string='MSFID', type='char', size=18, store=True, write_relate=False, _fnct_migrate=xmlid_code_migration),1552 'xmlid_code': fields.related('product_id', 'xmlid_code', string='MSFID', type='char', size=18, store=True, write_relate=False, _fnct_migrate=xmlid_code_migration),
1503 'old_code': fields.related('product_id', 'old_code', string='Old Code', type='char'),1553 'old_code': fields.related('product_id', 'old_code', string='Old Code', type='char', write_relate=False),
1504 'name': fields.related('product_id', 'name', string='Name', type='char'),1554 'name': fields.related('product_id', 'name', string='Name', type='char', write_relate=False),
1505 'categ_id': fields.related('product_id', 'categ_id', string='Category', type='many2one', relation='product.category',1555 'categ_id': fields.related('product_id', 'categ_id', string='Category', type='many2one', relation='product.category',
1506 store={'product.template': (_get_template, ['type'], 10),1556 store={'product.template': (_get_template, ['type'], 10),
1507 'stock.mission.report.line': (lambda self, cr, uid, ids, c={}: ids, ['product_id'], 10)},1557 'stock.mission.report.line': (lambda self, cr, uid, ids, c={}: ids, ['product_id'], 10)},
@@ -1526,17 +1576,17 @@
1526 ),1576 ),
1527 'product_state': fields.char(size=128, string='Unifield state'),1577 'product_state': fields.char(size=128, string='Unifield state'),
1528 # mandatory nomenclature levels1578 # mandatory nomenclature levels
1529 'nomen_manda_0': fields.related('product_id', 'nomen_manda_0', type='many2one', relation='product.nomenclature', string='Main Type'),1579 'nomen_manda_0': fields.related('product_id', 'nomen_manda_0', type='many2one', relation='product.nomenclature', string='Main Type', write_relate=False),
1530 'nomen_manda_1': fields.related('product_id', 'nomen_manda_1', type='many2one', relation='product.nomenclature', string='Group'),1580 'nomen_manda_1': fields.related('product_id', 'nomen_manda_1', type='many2one', relation='product.nomenclature', string='Group', write_relate=False),
1531 'nomen_manda_2': fields.related('product_id', 'nomen_manda_2', type='many2one', relation='product.nomenclature', string='Family'),1581 'nomen_manda_2': fields.related('product_id', 'nomen_manda_2', type='many2one', relation='product.nomenclature', string='Family', write_relate=False),
1532 'nomen_manda_3': fields.related('product_id', 'nomen_manda_3', type='many2one', relation='product.nomenclature', string='Root'),1582 'nomen_manda_3': fields.related('product_id', 'nomen_manda_3', type='many2one', relation='product.nomenclature', string='Root', write_relate=False),
1533 # optional nomenclature levels1583 # optional nomenclature levels
1534 'nomen_sub_0': fields.related('product_id', 'nomen_sub_0', type='many2one', relation='product.nomenclature', string='Sub Class 1'),1584 'nomen_sub_0': fields.related('product_id', 'nomen_sub_0', type='many2one', relation='product.nomenclature', string='Sub Class 1', write_relate=False),
1535 'nomen_sub_1': fields.related('product_id', 'nomen_sub_1', type='many2one', relation='product.nomenclature', string='Sub Class 2'),1585 'nomen_sub_1': fields.related('product_id', 'nomen_sub_1', type='many2one', relation='product.nomenclature', string='Sub Class 2', write_relate=False),
1536 'nomen_sub_2': fields.related('product_id', 'nomen_sub_2', type='many2one', relation='product.nomenclature', string='Sub Class 3'),1586 'nomen_sub_2': fields.related('product_id', 'nomen_sub_2', type='many2one', relation='product.nomenclature', string='Sub Class 3', write_relate=False),
1537 'nomen_sub_3': fields.related('product_id', 'nomen_sub_3', type='many2one', relation='product.nomenclature', string='Sub Class 4'),1587 'nomen_sub_3': fields.related('product_id', 'nomen_sub_3', type='many2one', relation='product.nomenclature', string='Sub Class 4', write_relate=False),
1538 'nomen_sub_4': fields.related('product_id', 'nomen_sub_4', type='many2one', relation='product.nomenclature', string='Sub Class 5'),1588 'nomen_sub_4': fields.related('product_id', 'nomen_sub_4', type='many2one', relation='product.nomenclature', string='Sub Class 5', write_relate=False),
1539 'nomen_sub_5': fields.related('product_id', 'nomen_sub_5', type='many2one', relation='product.nomenclature', string='Sub Class 6'),1589 'nomen_sub_5': fields.related('product_id', 'nomen_sub_5', type='many2one', relation='product.nomenclature', string='Sub Class 6', write_relate=False),
1540 'nomen_manda_0_s': fields.function(_get_nomen_s, method=True, type='many2one', relation='product.nomenclature', string='Main Type', fnct_search=_search_nomen_s, multi="nom_s"),1590 'nomen_manda_0_s': fields.function(_get_nomen_s, method=True, type='many2one', relation='product.nomenclature', string='Main Type', fnct_search=_search_nomen_s, multi="nom_s"),
1541 'nomen_manda_1_s': fields.function(_get_nomen_s, method=True, type='many2one', relation='product.nomenclature', string='Group', fnct_search=_search_nomen_s, multi="nom_s"),1591 'nomen_manda_1_s': fields.function(_get_nomen_s, method=True, type='many2one', relation='product.nomenclature', string='Group', fnct_search=_search_nomen_s, multi="nom_s"),
1542 'nomen_manda_2_s': fields.function(_get_nomen_s, method=True, type='many2one', relation='product.nomenclature', string='Family', fnct_search=_search_nomen_s, multi="nom_s"),1592 'nomen_manda_2_s': fields.function(_get_nomen_s, method=True, type='many2one', relation='product.nomenclature', string='Family', fnct_search=_search_nomen_s, multi="nom_s"),
@@ -1552,8 +1602,8 @@
1552 'product_amc': fields.float('AMC'),1602 'product_amc': fields.float('AMC'),
1553 'product_consumption': fields.float('FMC'),1603 'product_consumption': fields.float('FMC'),
15541604
1555 'currency_id': fields.related('product_id', 'currency_id', type='many2one', relation='res.currency', string='Func. cur.'),1605 'currency_id': fields.related('product_id', 'currency_id', type='many2one', relation='res.currency', string='Func. cur.', write_relate=False),
1556 'cost_price': fields.related('product_id', 'standard_price', type='float', string='Cost price'),1606 'cost_price': fields.related('product_id', 'standard_price', type='float', string='Cost price', write_relate=False),
1557 'uom_id': fields.related('product_id', 'uom_id', type='many2one', relation='product.uom', string='UoM',1607 'uom_id': fields.related('product_id', 'uom_id', type='many2one', relation='product.uom', string='UoM',
1558 store={1608 store={
1559 'product.template': (_get_template, ['type'], 10),1609 'product.template': (_get_template, ['type'], 10),
@@ -1582,7 +1632,7 @@
1582 'in_pipe_coor_qty': fields.float(digits=(16,2), string='In Pipe from Coord.', related_uom='uom_id'),1632 'in_pipe_coor_qty': fields.float(digits=(16,2), string='In Pipe from Coord.', related_uom='uom_id'),
1583 'in_pipe_coor_val': fields.float(digits=(16,2), string='In Pipe from Coord.', related_uom='uom_id'),1633 'in_pipe_coor_val': fields.float(digits=(16,2), string='In Pipe from Coord.', related_uom='uom_id'),
1584 'updated': fields.boolean(string='Updated'),1634 'updated': fields.boolean(string='Updated'),
1585 'full_view': fields.related('mission_report_id', 'full_view', string='Full view', type='boolean', store=True),1635 'full_view': fields.related('mission_report_id', 'full_view', string='Full view', type='boolean', store=True, write_relate=False),
1586 'instance_id': fields.many2one(1636 'instance_id': fields.many2one(
1587 'msf.instance',1637 'msf.instance',
1588 string='HQ Instance',1638 string='HQ Instance',
@@ -1591,6 +1641,8 @@
1591 'quarantine_qty': fields.float(digits=(16, 2), string='Quarantine Qty.', related_uom='uom_id'),1641 'quarantine_qty': fields.float(digits=(16, 2), string='Quarantine Qty.', related_uom='uom_id'),
1592 'input_qty': fields.float(digits=(16, 2), string='Input Qty.', related_uom='uom_id'),1642 'input_qty': fields.float(digits=(16, 2), string='Input Qty.', related_uom='uom_id'),
1593 'opdd_qty': fields.float(digits=(16, 2), string='Output/Packing/Dispatch/Distribution Qty.', related_uom='uom_id'),1643 'opdd_qty': fields.float(digits=(16, 2), string='Output/Packing/Dispatch/Distribution Qty.', related_uom='uom_id'),
1644 'used_in_transaction': fields.boolean('Used in a transaction'),
1645 'transaction_updated': fields.boolean('Used changed', help='temporary value used to touch ir.model.data'),
1594 }1646 }
15951647
1596 @tools.cache(skiparg=2)1648 @tools.cache(skiparg=2)
@@ -1642,7 +1694,8 @@
1642 sum(l.internal_qty)*t.standard_price AS internal_val,1694 sum(l.internal_qty)*t.standard_price AS internal_val,
1643 sum(l.quarantine_qty) AS quarantine_qty,1695 sum(l.quarantine_qty) AS quarantine_qty,
1644 sum(l.input_qty) AS input_qty,1696 sum(l.input_qty) AS input_qty,
1645 sum(l.opdd_qty) AS opdd_qty1697 sum(l.opdd_qty) AS opdd_qty,
1698 bool_or(used_in_transaction) AS used_in_transaction
1646 FROM stock_mission_report_line l1699 FROM stock_mission_report_line l
1647 LEFT JOIN1700 LEFT JOIN
1648 stock_mission_report m1701 stock_mission_report m
@@ -1683,10 +1736,10 @@
1683 internal_qty=%s, stock_qty=%s,1736 internal_qty=%s, stock_qty=%s,
1684 cross_qty=%s, secondary_qty=%s,1737 cross_qty=%s, secondary_qty=%s,
1685 cu_qty=%s, in_pipe_qty=%s, in_pipe_coor_qty=%s,1738 cu_qty=%s, in_pipe_qty=%s, in_pipe_coor_qty=%s,
1686 wh_qty=%s, quarantine_qty=%s, input_qty=%s, opdd_qty=%s1739 wh_qty=%s, quarantine_qty=%s, input_qty=%s, opdd_qty=%s, used_in_transaction=%s
1687 WHERE id=%s""" % (line[1] or 0.00, line[2] or 0.00, line[3] or 0.00, line[4] or 0.00,1740 WHERE id=%s""" % (line[1] or 0.00, line[2] or 0.00, line[3] or 0.00, line[4] or 0.00,
1688 line[5] or 0.00, line[6] or 0.00, line[7] or 0.00,1741 line[5] or 0.00, line[6] or 0.00, line[7] or 0.00,
1689 (line[2] or 0.00) + (line[3] or 0.00), line[9], line[10], line[11], line_id)) # not_a_user_entry1742 (line[2] or 0.00) + (line[3] or 0.00), line[9], line[10], line[11], line[12] or False, line_id)) # not_a_user_entry
1690 return True1743 return True
16911744
16921745
16931746
=== modified file 'bin/addons/mission_stock/mission_stock_view.xml'
--- bin/addons/mission_stock/mission_stock_view.xml 2020-10-20 15:57:14 +0000
+++ bin/addons/mission_stock/mission_stock_view.xml 2021-09-27 10:27:25 +0000
@@ -80,6 +80,7 @@
80 <field name="default_code"/>80 <field name="default_code"/>
81 <field name="name"/>81 <field name="name"/>
82 <field name="categ_id" widget="selection" operator="child_of"/>82 <field name="categ_id" widget="selection" operator="child_of"/>
83 <field name="used_in_transaction" />
83 <newline/>84 <newline/>
84 <filter string="Single Item" icon="terp-accessories-archiver" domain="[('subtype','=','single')]"/>85 <filter string="Single Item" icon="terp-accessories-archiver" domain="[('subtype','=','single')]"/>
85 <filter string="Kit/Module" icon="terp-accessories-archiver" domain="[('subtype','=','kit')]"/>86 <filter string="Kit/Module" icon="terp-accessories-archiver" domain="[('subtype','=','kit')]"/>
@@ -152,12 +153,51 @@
152 <!-- <field name="cu_val" invisible="not context.get('with_valuation')" /> -->153 <!-- <field name="cu_val" invisible="not context.get('with_valuation')" /> -->
153 <field name="product_amc" invisible="context.get('hide_amc_fmc')"/>154 <field name="product_amc" invisible="context.get('hide_amc_fmc')"/>
154 <field name="product_consumption" invisible="context.get('hide_amc_fmc')" />155 <field name="product_consumption" invisible="context.get('hide_amc_fmc')" />
156 <field name="used_in_transaction" />
155 <field name="in_pipe_qty" />157 <field name="in_pipe_qty" />
156 <field name="categ_id" invisible="1" />158 <field name="categ_id" invisible="1" />
157 <field name="type" invisible="1" />159 <field name="type" invisible="1" />
158 </tree>160 </tree>
159 </field>161 </field>
160 </record>162 </record>
163
164 <record id="mission_stock_line_form_view" model="ir.ui.view">
165 <field name="name">mission.stock.product.form.view</field>
166 <field name="model">stock.mission.report.line</field>
167 <field name="type">form</field>
168 <field name="arch" type="xml">
169 <form string="Mission Stock Report" noteditable="1" hide_new_button="1" hide_save_button="1" hide_duplicate_button="1" hide_delete_button="1">
170 <field name="product_id" />
171 <field name="default_code" />
172 <field name="name" />
173 <field name="product_active" />
174 <field name="uom_id" />
175 <field name="cost_price" invisible="not context.get('with_valuation')" />
176 <field name="currency_id" invisible="not context.get('with_valuation')" />
177 <field name="internal_qty" />
178 <field name="internal_val" invisible="not context.get('with_valuation')" />
179 <!-- field name="in_pipe_coor_qty" />
180 <field name="in_pipe_coor_val" invisible="not context.get('with_valuation')" / -->
181 <field name="stock_qty" />
182 <field name="cross_qty" />
183 <!-- <field name="cross_val" invisible="not context.get('with_valuation')" /> -->
184 <field name="secondary_qty" />
185 <!-- <field name="secondary_val" invisible="not context.get('with_valuation')" /> -->
186 <field name="cu_qty" />
187 <field name="quarantine_qty" />
188 <field name="input_qty" />
189 <field name="opdd_qty" />
190 <!-- <field name="cu_val" invisible="not context.get('with_valuation')" /> -->
191 <field name="product_amc" invisible="context.get('hide_amc_fmc')"/>
192 <field name="product_consumption" invisible="context.get('hide_amc_fmc')" />
193 <field name="used_in_transaction" />
194 <field name="in_pipe_qty" />
195 <field name="categ_id" invisible="1" />
196 <field name="type" invisible="1" />
197 </form>
198 </field>
199 </record>
200
161201
162 <record id="consolidated_mission_stock_wizard_view" model="ir.ui.view">202 <record id="consolidated_mission_stock_wizard_view" model="ir.ui.view">
163 <field name="name">consolidated.mission.stock.wizard.view</field>203 <field name="name">consolidated.mission.stock.wizard.view</field>
164204
=== modified file 'bin/addons/msf_profile/data/patches.xml'
--- bin/addons/msf_profile/data/patches.xml 2021-08-18 16:06:31 +0000
+++ bin/addons/msf_profile/data/patches.xml 2021-09-27 10:27:25 +0000
@@ -701,5 +701,8 @@
701 <record id="us_9003_partner_im_is_currencies" model="patch.scripts">701 <record id="us_9003_partner_im_is_currencies" model="patch.scripts">
702 <field name="method">us_9003_partner_im_is_currencies</field>702 <field name="method">us_9003_partner_im_is_currencies</field>
703 </record>703 </record>
704 <record id="us_8336_update_msr_used" model="patch.scripts">
705 <field name="method">us_8336_update_msr_used</field>
706 </record>
704 </data>707 </data>
705</openerp>708</openerp>
706709
=== modified file 'bin/addons/msf_profile/msf_profile.py'
--- bin/addons/msf_profile/msf_profile.py 2021-08-19 10:03:30 +0000
+++ bin/addons/msf_profile/msf_profile.py 2021-09-27 10:27:25 +0000
@@ -37,6 +37,7 @@
37from msf_field_access_rights.osv_override import _get_instance_level37from msf_field_access_rights.osv_override import _get_instance_level
38import cStringIO38import cStringIO
39import csv39import csv
40import zlib
4041
4142
42class patch_scripts(osv.osv):43class patch_scripts(osv.osv):
@@ -53,6 +54,65 @@
53 'model': lambda *a: 'patch.scripts',54 'model': lambda *a: 'patch.scripts',
54 }55 }
5556
57 def us_8336_update_msr_used(self, cr, uid, *a, **b):
58 if not self.pool.get('sync.client.entity'):
59 # exclude new instances
60 return True
61
62 if _get_instance_level(self, cr, uid) == 'hq':
63 # exclude hq
64 return True
65
66 doc_field_error_dom = [
67 ('stock_move', 'product_id'),
68 ('stock_production_lot', 'product_id'),
69 ('purchase_order_line', 'product_id'),
70 ('sale_order_line', 'product_id'),
71 ('tender_line', 'product_id'),
72 ('physical_inventory_counting', 'product_id'),
73 ('initial_stock_inventory_line', 'product_id'),
74 ('real_average_consumption_line', 'product_id'),
75 ('replenishment_segment_line', 'product_id'),
76 ('product_list_line', 'name'),
77 ('composition_kit', 'composition_product_id'),
78 ('composition_item', 'item_product_id'),
79 ]
80 report_ids = self.pool.get('stock.mission.report').search(cr, uid, [('local_report', '=', True), ('full_view', '=', False)])
81 if not report_ids:
82 return True
83 report_id = report_ids[0]
84 for table, foreign_field in doc_field_error_dom:
85 # set used_in_transaction='t'
86 cr.execute('''
87 update
88 stock_mission_report_line l
89 set
90 used_in_transaction='t'
91 from
92 ''' + table + ''' ft
93 where
94 coalesce(l.used_in_transaction,'f')='f' and
95 l.mission_report_id = %s and
96 ft.''' + foreign_field + ''' = l.product_id
97 ''', (report_id, )) # not_a_user_entry
98
99 cr.execute('''
100 select d.name
101 from ir_model_data d, stock_mission_report_line l
102 where
103 l.id = d.res_id and
104 used_in_transaction='t' and
105 d.model='stock.mission.report.line' and
106 l.mission_report_id = %s
107 ''', (report_id,))
108 if cr.rowcount:
109 zipstr = base64.b64encode(zlib.compress(','.join([x[0] for x in cr.fetchall()])))
110 self.pool.get('sync.trigger.something.up').create(cr, uid, {'name': 'msr_used', 'args': zipstr})
111 return True
112
113
114
115
56 # UF22.0116 # UF22.0
57 def us_9003_partner_im_is_currencies(self, cr, uid, *a, **b):117 def us_9003_partner_im_is_currencies(self, cr, uid, *a, **b):
58 self.us_5559_set_pricelist(cr, uid, *a, **b)118 self.us_5559_set_pricelist(cr, uid, *a, **b)
@@ -4962,7 +5022,17 @@
4962 if remote_id:5022 if remote_id:
4963 cr.execute("update stock_mission_report_line set cu_qty=0, cu_val=0 where mission_report_id in (select id from stock_mission_report where instance_id = %s and full_view='f')", (remote_id[0],))5023 cr.execute("update stock_mission_report_line set cu_qty=0, cu_val=0 where mission_report_id in (select id from stock_mission_report where instance_id = %s and full_view='f')", (remote_id[0],))
4964 _logger.warn('Reset %d mission stock CU Stock for instance_id %s' % (cr.rowcount, remote_id[0]))5024 _logger.warn('Reset %d mission stock CU Stock for instance_id %s' % (cr.rowcount, remote_id[0]))
49655025 elif vals.get('name') == 'msr_used':
5026 cr.execute('''
5027 update stock_mission_report_line l
5028 set used_in_transaction='t'
5029 from
5030 ir_model_data d
5031 where
5032 d.model='stock.mission.report.line' and
5033 d.res_id = l.id and
5034 d.name in %s
5035 ''', (tuple((zlib.decompress(base64.b64decode(vals.get('args'))).split(','))),))
4966 return super(sync_tigger_something_up, self).create(cr, uid, vals, context)5036 return super(sync_tigger_something_up, self).create(cr, uid, vals, context)
49675037
4968sync_tigger_something_up()5038sync_tigger_something_up()
49695039
=== modified file 'bin/addons/msf_sync_data_server/data/sync_server.sync_rule.csv'
--- bin/addons/msf_sync_data_server/data/sync_server.sync_rule.csv 2021-06-07 13:41:02 +0000
+++ bin/addons/msf_sync_data_server/data/sync_server.sync_rule.csv 2021-09-27 10:27:25 +0000
@@ -100,8 +100,8 @@
100msf_sync_data_server.budget_line,TRUE,TRUE,FALSE,FALSE,bidirectional,Up,"[('budget_id','in',('msf.budget','id',[('type','=','normal'), ('state', '!=', 'draft')]))]","['account_id/id', 'budget_id/id', 'month1', 'month2', 'month3', 'month4', 'month5', 'month6', 'month7', 'month8', 'month9', 'month10', 'month11', 'month12', 'destination_id/id', 'line_type']",OC,msf.budget.line,,Budget line,Valid,,431100msf_sync_data_server.budget_line,TRUE,TRUE,FALSE,FALSE,bidirectional,Up,"[('budget_id','in',('msf.budget','id',[('type','=','normal'), ('state', '!=', 'draft')]))]","['account_id/id', 'budget_id/id', 'month1', 'month2', 'month3', 'month4', 'month5', 'month6', 'month7', 'month8', 'month9', 'month10', 'month11', 'month12', 'destination_id/id', 'line_type']",OC,msf.budget.line,,Budget line,Valid,,431
101msf_sync_data_server.budget_status,TRUE,TRUE,FALSE,FALSE,bidirectional,Up,"[('type','=','normal'), ('state', '!=', 'draft')]",['state'],OC,msf.budget,,Budget status,Valid,,432101msf_sync_data_server.budget_status,TRUE,TRUE,FALSE,FALSE,bidirectional,Up,"[('type','=','normal'), ('state', '!=', 'draft')]",['state'],OC,msf.budget,,Budget status,Valid,,432
102msf_sync_data_server.mission_stock_report,TRUE,TRUE,FALSE,FALSE,bidirectional,Up,"[('full_view', '=', False), ('local_report', '=', True)]","['full_view', 'instance_id/id', 'last_update', 'name']",OC,stock.mission.report,,Mission Stock Report,Valid,,440102msf_sync_data_server.mission_stock_report,TRUE,TRUE,FALSE,FALSE,bidirectional,Up,"[('full_view', '=', False), ('local_report', '=', True)]","['full_view', 'instance_id/id', 'last_update', 'name']",OC,stock.mission.report,,Mission Stock Report,Valid,,440
103msf_sync_data_server.mission_stock_report_line,TRUE,TRUE,FALSE,FALSE,bidirectional,Up,"[('mission_report_id.full_view', '=', False), ('mission_report_id.local_report', '=', True), ('international_status','in',['Local', 'Temporary'])]","['cross_qty', 'cross_val', 'cu_qty', 'cu_val', 'in_pipe_coor_qty', 'in_pipe_coor_val', 'in_pipe_qty', 'in_pipe_val', 'internal_qty', 'internal_val', 'mission_report_id/id', 'product_id/id', 'secondary_qty', 'secondary_val', 'stock_qty', 'stock_val', 'xmlid_code', 'product_state', 'product_active', 'state_ud', 'international_status_code', 'product_amc', 'product_consumption', 'quarantine_qty', 'input_qty', 'opdd_qty']",MISSION,stock.mission.report.line,,Mission Stock Report Line,Valid,,441103msf_sync_data_server.mission_stock_report_line,TRUE,TRUE,FALSE,FALSE,bidirectional,Up,"[('mission_report_id.full_view', '=', False), ('mission_report_id.local_report', '=', True), ('international_status','in',['Local', 'Temporary'])]","['cross_qty', 'cross_val', 'cu_qty', 'cu_val', 'in_pipe_coor_qty', 'in_pipe_coor_val', 'in_pipe_qty', 'in_pipe_val', 'internal_qty', 'internal_val', 'mission_report_id/id', 'product_id/id', 'secondary_qty', 'secondary_val', 'stock_qty', 'stock_val', 'xmlid_code', 'product_state', 'product_active', 'state_ud', 'international_status_code', 'product_amc', 'product_consumption', 'quarantine_qty', 'input_qty', 'opdd_qty', 'used_in_transaction']",MISSION,stock.mission.report.line,,Mission Stock Report Line,Valid,,441
104msf_sync_data_server.mission_stock_report_line_OC,TRUE,TRUE,FALSE,FALSE,bidirectional,Up,"[('mission_report_id.full_view', '=', False), ('mission_report_id.local_report', '=', True), ('international_status','in',['ITC', 'UniData', 'ESC', 'HQ'])]","['cross_qty', 'cross_val', 'cu_qty', 'cu_val', 'in_pipe_coor_qty', 'in_pipe_coor_val', 'in_pipe_qty', 'in_pipe_val', 'internal_qty', 'internal_val', 'mission_report_id/id', 'product_id/id', 'secondary_qty', 'secondary_val', 'stock_qty', 'stock_val', 'xmlid_code', 'product_state', 'product_active', 'state_ud', 'international_status_code', 'product_amc', 'product_consumption', 'quarantine_qty', 'input_qty', 'opdd_qty']",OC,stock.mission.report.line,,Mission Stock Report Line OC,Valid,,442104msf_sync_data_server.mission_stock_report_line_OC,TRUE,TRUE,FALSE,FALSE,bidirectional,Up,"[('mission_report_id.full_view', '=', False), ('mission_report_id.local_report', '=', True), ('international_status','in',['ITC', 'UniData', 'ESC', 'HQ'])]","['cross_qty', 'cross_val', 'cu_qty', 'cu_val', 'in_pipe_coor_qty', 'in_pipe_coor_val', 'in_pipe_qty', 'in_pipe_val', 'internal_qty', 'internal_val', 'mission_report_id/id', 'product_id/id', 'secondary_qty', 'secondary_val', 'stock_qty', 'stock_val', 'xmlid_code', 'product_state', 'product_active', 'state_ud', 'international_status_code', 'product_amc', 'product_consumption', 'quarantine_qty', 'input_qty', 'opdd_qty', 'used_in_transaction']",OC,stock.mission.report.line,,Mission Stock Report Line OC,Valid,,442
105msf_sync_data_server.financing_contract_formats_fc,TRUE,TRUE,FALSE,TRUE,bidirectional,Bidirectional-Private,[],"['cost_center_ids/id', 'eligibility_from_date', 'eligibility_to_date', 'format_name', 'overhead_percentage', 'overhead_type', 'reporting_type', 'hidden_instance_id/id']",HQ + MISSION,financing.contract.format,hidden_instance_id,Financing Contract Formats FC,Valid,,450105msf_sync_data_server.financing_contract_formats_fc,TRUE,TRUE,FALSE,TRUE,bidirectional,Bidirectional-Private,[],"['cost_center_ids/id', 'eligibility_from_date', 'eligibility_to_date', 'format_name', 'overhead_percentage', 'overhead_type', 'reporting_type', 'hidden_instance_id/id']",HQ + MISSION,financing.contract.format,hidden_instance_id,Financing Contract Formats FC,Valid,,450
106msf_sync_data_server.financing_contract_formats,TRUE,TRUE,TRUE,TRUE,bidirectional,Bidirectional,"[('hidden_instance_id','=',False)]","['hidden_instance_id/id','cost_center_ids/id', 'eligibility_from_date', 'eligibility_to_date', 'format_name', 'overhead_percentage', 'overhead_type', 'reporting_type']",HQ + MISSION,financing.contract.format,,Financing Contract Formats,Valid,,451106msf_sync_data_server.financing_contract_formats,TRUE,TRUE,TRUE,TRUE,bidirectional,Bidirectional,"[('hidden_instance_id','=',False)]","['hidden_instance_id/id','cost_center_ids/id', 'eligibility_from_date', 'eligibility_to_date', 'format_name', 'overhead_percentage', 'overhead_type', 'reporting_type']",HQ + MISSION,financing.contract.format,,Financing Contract Formats,Valid,,451
107msf_sync_data_server.financing_contract_format_lines,TRUE,TRUE,TRUE,TRUE,bidirectional,Bidirectional,"[('instance_id', '=', False)]","['account_destination_ids/id', 'instance_id/id','allocated_budget_value', 'allocated_real_value', 'code', 'format_id/id', 'line_type', 'name', 'overhead_percentage', 'overhead_type', 'project_budget_value', 'project_real_value', 'is_quadruplet', 'quadruplet_sync_list', 'reporting_select_accounts_only', 'reporting_account_ids/id']",HQ + MISSION,financing.contract.format.line,,Financing Contract Format Lines,Valid,,452107msf_sync_data_server.financing_contract_format_lines,TRUE,TRUE,TRUE,TRUE,bidirectional,Bidirectional,"[('instance_id', '=', False)]","['account_destination_ids/id', 'instance_id/id','allocated_budget_value', 'allocated_real_value', 'code', 'format_id/id', 'line_type', 'name', 'overhead_percentage', 'overhead_type', 'project_budget_value', 'project_real_value', 'is_quadruplet', 'quadruplet_sync_list', 'reporting_select_accounts_only', 'reporting_account_ids/id']",HQ + MISSION,financing.contract.format.line,,Financing Contract Format Lines,Valid,,452
108108
=== modified file 'bin/addons/product_attributes/product_attributes.py'
--- bin/addons/product_attributes/product_attributes.py 2021-08-18 14:49:48 +0000
+++ bin/addons/product_attributes/product_attributes.py 2021-09-27 10:27:25 +0000
@@ -2737,6 +2737,7 @@
2737 ('composition.kit', 'composition_product_id', _('Composition Kit(s)'), []),2737 ('composition.kit', 'composition_product_id', _('Composition Kit(s)'), []),
2738 ('composition.item', 'item_product_id', _('Composition Kit line(s)'), []),2738 ('composition.item', 'item_product_id', _('Composition Kit line(s)'), []),
2739 ]2739 ]
2740 # please update also doc_field_error_dom in bin/addons/mission_stock/mission_stock.py
27402741
2741 for obj, field, msg, dom in doc_field_error_dom:2742 for obj, field, msg, dom in doc_field_error_dom:
2742 nb = self.pool.get(obj).search(cr, uid, [(field, '=', prod_id)]+dom, count=True, context=context)2743 nb = self.pool.get(obj).search(cr, uid, [(field, '=', prod_id)]+dom, count=True, context=context)
@@ -2755,7 +2756,7 @@
27552756
2756 cr.execute('''2757 cr.execute('''
2757 select2758 select
2758 l.product_id2759 l.product_id, array_agg(i.code)
2759 from2760 from
2760 stock_mission_report r, msf_instance i, stock_mission_report_line l2761 stock_mission_report r, msf_instance i, stock_mission_report_line l
2761 where2762 where
@@ -2764,10 +2765,10 @@
2764 l.mission_report_id = r.id and2765 l.mission_report_id = r.id and
2765 l.product_id in %s and2766 l.product_id in %s and
2766 r.full_view = 'f' and2767 r.full_view = 'f' and
2767 ( l.internal_qty > 0 or l.in_pipe_qty > 0)2768 ( l.internal_qty > 0 or l.in_pipe_qty > 0 or l.used_in_transaction='t')
2768 group by l.product_id2769 group by l.product_id
2769 ''' , (tuple(ids), ))2770 ''' , (tuple(ids), ))
2770 return [x[0] for x in cr.fetchall()]2771 return [(x[0],', '.join(x[1])) for x in cr.fetchall()]
27712772
27722773
2773 def merge_product(self, cr, uid, nsl_prod_id, local_id, context=None):2774 def merge_product(self, cr, uid, nsl_prod_id, local_id, context=None):
@@ -2782,8 +2783,9 @@
2782 if error_used:2783 if error_used:
2783 raise osv.except_osv(_('Warning'), _('The selected UD product %s has already been used in the past. Merge cannot be done for this product') % (new_data['default_code'], ))2784 raise osv.except_osv(_('Warning'), _('The selected UD product %s has already been used in the past. Merge cannot be done for this product') % (new_data['default_code'], ))
27842785
2785 if self._has_pipe(cr, uid, nsl_prod_id):2786 has_pipe = self._has_pipe(cr, uid, nsl_prod_id)
2786 raise osv.except_osv(_('Warning'), _('Warning there is stock / pipeline in at least one of the instances in this mission! Therefore the product cannot be merged') % (new_data['default_code'], ))2787 if has_pipe:
2788 raise osv.except_osv(_('Warning'), _('Warning there is stock / pipeline in at least one of the instances in this mission! Therefore the product cannot be merged. Instance(s): %s') % (has_pipe[0][1], ))
27872789
2788 local_dom = [('id', '=', local_id), ('international_status', '=', 'Local'), ('replaced_by_product_id', '=', False)]2790 local_dom = [('id', '=', local_id), ('international_status', '=', 'Local'), ('replaced_by_product_id', '=', False)]
2789 if not context.get('sync_update_execution'):2791 if not context.get('sync_update_execution'):
27902792
=== modified file 'bin/addons/product_attributes/wizard/product_merged.py'
--- bin/addons/product_attributes/wizard/product_merged.py 2020-05-04 16:40:38 +0000
+++ bin/addons/product_attributes/wizard/product_merged.py 2021-09-27 10:27:25 +0000
@@ -26,8 +26,9 @@
26 if error_used:26 if error_used:
27 raise osv.except_osv(_('Warning'), _('The selected UD product has already been used in the past. Merge cannot be done for this product.'))27 raise osv.except_osv(_('Warning'), _('The selected UD product has already been used in the past. Merge cannot be done for this product.'))
2828
29 if prod_obj._has_pipe(cr, uid, wiz.new_product_id.id):29 has_pipe = prod_obj._has_pipe(cr, uid, wiz.new_product_id.id)
30 raise osv.except_osv(_('Warning'), _('Warning there is stock / pipeline in at least one of the instances in this mission! Therefore this product cannot be merged.'))30 if has_pipe:
31 raise osv.except_osv(_('Warning'), _('Warning there is stock / pipeline in at least one of the instances in this mission! Therefore this product cannot be merged. Instances: %s') % (has_pipe[0][1], ))
3132
32 block_msg = prod_obj.check_same_value(cr, uid, wiz.new_product_id.id, wiz.old_product_id.id, blocker=True, context=context)33 block_msg = prod_obj.check_same_value(cr, uid, wiz.new_product_id.id, wiz.old_product_id.id, blocker=True, context=context)
33 if block_msg:34 if block_msg:

Subscribers

People subscribed via source and target branches